Ruby Gem install Json fails on Mavericks and Xcode 5.1 - unknown argument: '-multiply_definedsuppress'

前端 未结 11 1413
醉酒成梦
醉酒成梦 2020-11-22 03:39

I was trying run gem install json and got the following error

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    /System/Library/Framewo         


        
相关标签:
11条回答
  • 2020-11-22 04:20

    Issue already addressed by Ruby:

    https://bugs.ruby-lang.org/issues/9624

    now we just need to wait for Apple to update their ruby version (2.0.0p247) to the one after the latest one (2.0.0p451) which hasn't come out yet ... (or brew/macport it)

    Update (2014-05-15): Mavericks 10.9.3 updates ruby to ruby 2.0.0p451 (2014-02-24 revision 45167) [universal.x86_64-darwin13] And this seems to resolves the issue.

    0 讨论(0)
  • 2020-11-22 04:22

    It's been a while and I've got similar error. An alternative to folks using bundler is to add the flag to the build configuration like below example:

    bundle config build.<gemname> --with-cflags="-Wno-error=implicit-function-declaration"
    

    followed by

    bundle install
    

    Please note that you must replace <gemname> above with the name of the actual gem that is throwing the error while building native extensions.

    I hope this becomes helpful to others that face similar issues in the future!

    0 讨论(0)
  • 2020-11-22 04:24

    To address the issue you can install the most recent version of ruby as described by @Sash. You can use the following commands to do so. In case you already have installed rvm, you don't need to reinstall it.

    #Install rvm
    \curl -sSL https://get.rvm.io | bash -s stable
    
    #Install ruby version 2.0.0-p451
    rvm install ruby-2.0.0-p451
    
    #Print ruby version to verify that it was installed successfully
    ruby -v
    
    #Install json gem
    sudo gem install json
    
    0 讨论(0)
  • 2020-11-22 04:24

    On OSX 10.10, I had several issues when running rails new firstapp such as:

    ERROR:  Error installing json:
    ERROR: Failed to build gem native extension.
    fatal error: 'ruby/config.h' file not found
    

    I updated rvm with this configuration and all the errors are gone!:

    rvm get stable --auto-dotfiles
    

    You can tell from the app name that I just started fiddling with Ruby on Rails, so the above advice may or may not work for you.

    0 讨论(0)
  • 2020-11-22 04:27

    Paul Chechetin's one-liner doesn't appear to work anymore (9/21/15). However, this reply to the post mentioned in Pete's reply solved the problem for me:

    • (a) Install Apple's XCode, then (b) launch it and accept the licensing terms (I had done (a), but not (b).)
    • sudo gem uninstall compass
    • sudo gem install compass
    0 讨论(0)
  • 2020-11-22 04:31

    In my case, I actually have similar problem, but not on the system ruby, but on rubies installed by rvm from OSX 10.8, and it has issues after upgrading to OSX 10.9.

    A simple reinstall works: rvm reinstall ruby-2.1.1

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