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

后端 未结 23 1746
深忆病人
深忆病人 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:25

    I was facing quite a similar error, and it was my first time installing CocoaPods on macOS Catalina. Finally managed by installing Xcode Commandline Tools. Type in the following command into your Terminal. (As of this day, this file is around 248.3mb)

    xcode-select --install
    

    A dialog should appear asking you to approve the download and installation. It might take a while to download depending on your internet speed. Once the installation is successful. Attempt to install CocoaPods once more with the following command in Terminal.

    sudo gem install cocoapods
    

    Once complete use the following command to confirm if installation was successful

    pod setup --verbose
    
    0 讨论(0)
  • 2020-12-04 19:26

    Alright,

    I had the same issue. Tried to install pods to my project but never worked out. I updated Xcode, Updated Command Line tools, reinstalled cocoapods... almost everything.

    Sitting on my ass , writing pod in terminal showed up a screen listing available commands.

    I read all of them and noticed the command

    pod setup
    

    which does

    + setup               Setup the CocoaPods environment
    

    After this line of code, my problem was fixed.

    I hope my solution help other people in trouble like me.

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

    None of previous solutions worked for me...

    My situation is a fresh clean install of macOS Catalina + XCODE;

    It happen that I had to first run Xcode before install cocoa pods (in first run, Xcode setups machine with tools);

    After that, cocoa pods worked fine.

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

    i had this issue when i tryed to install cocoapods by running the command "sudo gem install cocoapods", but i was able to install it with no problems using brew

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

    First as wrote "Kevin" try to run in terminal:

    xcode-select --install
    

    If it doesn't help you download tools manually from apple developer site:

    It helped me.

    0 讨论(0)
  • 2020-12-04 19:32
    brew reinstall ruby
    

    Add the below to your path

    export PATH="/usr/local/opt/ruby/bin:$PATH"
    

    If needed add these flags.

    export LDFLAGS="-L/usr/local/opt/ruby/lib"
    export CPPFLAGS="-I/usr/local/opt/ruby/include"
    
    0 讨论(0)
提交回复
热议问题