OS-X, Rails: “Failed to build gem native extension”

后端 未结 12 2165
梦毁少年i
梦毁少年i 2020-12-03 02:22

I\'m stuck trying to install rails on my mac. I have OS X 10.6.8 and I have confirmed that I have Ruby, version 1.8.7

I ran sudo gem update and su

相关标签:
12条回答
  • 2020-12-03 03:14

    The Command line tools didn't solve this issue for me. I upgraded ruby installation through rbenv to 2.2.0, made that the global default ruby installation, and this issue was fixed.

    0 讨论(0)
  • 2020-12-03 03:14

    Steps to sort out this issue: Follow these steps unless error is fixed.

    1. Open terminal and run command sudo xcode-select --install sudo xcodebuild -license accept
    2. Make sure you have installed only one xcode and it is latest one. If more than one xcode are installed then keep only the latest one with name in applications like Xcode.app
    3. Open Xcode->preferences->locations then check if anu command line tools is selected? If not then select.
    4. Install ruby by brew install ruby
    5. Install cocoapods by sudo gem install cocoapods
    0 讨论(0)
  • 2020-12-03 03:18

    Not sure what it needs to compile, but OSX can't compile any native ruby extensions at all unless the Apple developer tools are installed. On 10.7 Lion you can download it free from the app store, or Download it here for 10.6: http://developer.apple.com/xcode/index.php

    It may also be on your OSX install discs, though probably much more out of date.

    0 讨论(0)
  • 2020-12-03 03:18

    https://stackoverflow.com/a/58226876/8070378

    Solved after run:

    sudo xcode-select --install
    sudo xcodebuild -license accept
    
    0 讨论(0)
  • 2020-12-03 03:21

    Im using osx 10.10. You can download from the command-line

    xcode-select --install
    
    0 讨论(0)
  • 2020-12-03 03:25

    Just had a similar issue. I can confirm that installing the command line tools fixes it.

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