“gem install therubyracer -v '0.10.2'” on osx mavericks not installing

后端 未结 12 1692
说谎
说谎 2020-11-28 17:22

Trying to install therubyracer on mavericks using \"gem install therubyracer -v \'0.10.2\'\" but i am getting the following error:

/Users/dennischen/.rvm/rub         


        
相关标签:
12条回答
  • 2020-11-28 17:55

    What I did was to on osx mavericks:

    git clone git@github.com:cowboyd/therubyracer.git
    

    Then:

    gem build therubyracer.gemspec
    gem install therubyracer-0.12.1.gem
    

    This procedure downloaded a binary version of libv8 and installed it.

    0 讨论(0)
  • 2020-11-28 17:57

    If you decide to use a newer therubyracer gem version, you will no longer have this problem

    Otherwise:

    brew tap homebrew/dupes # Thanks Tom
    brew install apple-gcc42
    
    export CC=/usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/gcc-4.2
    export CXX=/usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/g++-4.2
    export CPP=/usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/cpp-4.2
    
    brew uninstall v8
    
    gem uninstall libv8
    
    gem install therubyracer -v '0.10.2' # specify version
    
    0 讨论(0)
  • 2020-11-28 18:00

    As suggested in many answers, the easiest thing to do is to compile The Ruby Racer native extensions with Apple GCC 4.2 (instead of the version installed with Xcode).

    If you're using MacPorts you shouldn't have to manually deal with setting up symbolic links for the GCC binaries. The port select command does it for you. If you haven't updated MacPorts since installing Mavericks, do a sudo port selfupdate. With MacPorts up-to-date, try the following:

    # If you don't have it, install the port for Apple's GCC 4.2
    sudo port install apple-gcc42 
    
        # OR
    
    # If you had apple-gcc42 already (before Mavericks), update it
    sudo port upgrade apple-gcc42
    
    
    # Same result as manual symlinking of GCC in other answers
    sudo port select gcc apple-gcc42 && hash -r
    
    # Install therubyracer, will install libv8 gem dependency
    #  *note* if you have any existing versions of these gems, remove them
    gem install therubyracer
    
    # Restore GCC to system default (optional)
    sudo port select gcc none && hash -r
    

    In general this procedure (sudo port select gcc [version]) will work any time you want to use a specific GCC version instead of the one installed by Xcode (Apple LLVM v5 for 10.9 Mavericks/Xcode 5).

    0 讨论(0)
  • 2020-11-28 18:01

    This should be a failsafe and clean way (no symlinks) to to install therubyracer for anyone having trouble.

    Taken from: gem install therubyracer -v 0.11.4 fails on OS X 10.10

    install Xcode (if you don't already have one of these versions) 6.1.1, 6.2-beta or 6.3-beta and (this one is needed) 4.6.3

    gem uninstall libv8 if you haven't already done so

    switch to Xcode 4.6.3

    sudo xcode-select --switch /Applications/Xcode4.6.3.app/Contents/Developer

    gem install libv8 -v '3.11.8.17' Or whichever version is tied to your version of therubyracer

    switch to Xcode 6.1.1, 6.2-beta or 6.3-beta (or if you want to try your current install of Xcode, adjust this line, I've confirmed all 3 of these work)

    sudo xcode-select --switch /Applications/Xcode6.1.1.app/Contents/Developer

    gem install therubyracer -v '0.11.4' or the version you're trying to install.

    0 讨论(0)
  • 2020-11-28 18:01

    I had this same problem when I upgraded from OSX Mountain Lion to OSX Mavericks.

    Upgrading from ruby-1.8.7-p354 to ruby-1.8.7-375 did the trick for me.

    Maybe try upgraded from ruby 1.9.3-p194 to rc1 (1.9.3 is above p484 now)

    assuming you use rbenv:

    rbenv install 1.9.3-rc1
    rbenv rehash
    rbenv global 1.9.3-rc1
    bundle install
    
    0 讨论(0)
  • 2020-11-28 18:06

    I had this problem after upgrading from Mavericks to Yosemite. The issue was that I compiled my Ruby version with the old version of OSX.

    If I ran

    ruby -rubygems -e 'puts Gem::Platform.new(RUBY_PLATFORM)'

    I would get x86_64-darwin-13 instead of x86_64-darwin-14 for Yosemite.

    To re-install Ruby I

    1. Completely removed old version: rvm remove ruby-2.1.1
    2. Re-installed from source (the --disable-binary doesnt use pre-compiled binaries and forces a build): rvm reinstall --disable-binary 2.1

    Then I was able to run bundle install with no errors after trying all the solutions above.

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