ERROR: Error installing cocoapods: ERROR: Failed to build gem native extension

后端 未结 23 1745
深忆病人
深忆病人 2020-12-04 19:06

I am trying to install cocoapods to my MacBook Pro running with OSX 10.9.1 (new Mavericks) and after type gem install cocoapods I get the following error:

相关标签:
23条回答
  • 2020-12-04 19:22

    I fixed the problem by using ruby 2.0 (which is the preferred way on mavericks) or greater. In case you are using rvm just change to the correct ruby with:

    rvm use ruby-2.0
    

    After that gem install cocoapods worked correctly. To be more specific, I was using:

    OSX 10.9.2
    ruby-2.0.0-p353
    cocoapods-0.32.1
    
    0 讨论(0)
  • 2020-12-04 19:22

    The same initial issue occurred when attempting to setup GoogleMaps in a Flutter app after running pod install on the iOS directory.

    Running pod install the following error appeared:

    zsh: /usr/local/bin/pod: bad interpreter: /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby: no such file or directory
    

    Next, after running sudo gem install cocoapods that resulted in another error similar to that shown at ERROR: Error installing cocoapods: ERROR: Failed to build gem native extension.

    ERROR:  Error installing cocoapods:
        ERROR: Failed to build gem native extension.
    

    kevin recommends installing Xcode Developer Tools running:

    xcode-select --install
    

    and while highlighting the need to install the tools, the system again produced the same error as before when running the pod install command.

    Refresing the tools by removing and reinstalling them became the next target. The tools are removed with the following command:

    rm -rf /Library/Developer/CommandLineTools
    

    And again installing the xcode developer tools using:

    xcode-select --install
    

    Then, sudo gem install cocoapods and pod install ran successfully.

    0 讨论(0)
  • 2020-12-04 19:22

    If none of above works then follow these steps

    1. sudo xcode-select --switch /Library/Developer/CommandLineTools
    2. sudo gem install cocoapods

    If you get error like this '

    ERROR:  While executing gem ... (Gem::FilePermissionError)
        You don't have write permissions for the /usr/bin directory
    

    .'

    then go to step 3

    1. $ sudo gem install -n /usr/local/bin cocoapods
    0 讨论(0)
  • 2020-12-04 19:23

    Run following command

     brew cleanup -d -v 
    

    Then run below command

    brew install cocoapods 
    

    Note: If you see failed to link then run brew link cocoapods

    This is how it get solved for me

    0 讨论(0)
  • 2020-12-04 19:24

    First install Homebrew if you don't have it: https://brew.sh/index_pt-br

    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
    

    Second, install ruby if you don't have it: https://www.ruby-lang.org/pt/documentation/installation/

    brew install ruby
    

    You can also follow these steps: https://gist.github.com/monicao/d372716cdfbb7e9cf692

    Then, close your terminal and reopen it again.

    Always use sudo to install cocoapods:

    sudo gem install cocoapods
    
    0 讨论(0)
  • 2020-12-04 19:25

    I fix the problem by follow step:

    1:rvm install 2.0.0

    2:rvm list * ruby-1.9.3-p545 [ x86_64 ] => ruby-2.0.0-p451 [ x86_64 ]

    3:rvm 2.0.0 —default

    4:pod update

    0 讨论(0)
提交回复
热议问题