How can I install Ruby on Rails 3 on OSX?

后端 未结 7 914
死守一世寂寞
死守一世寂寞 2020-12-24 03:26

I got a White Macbook and I have to go to a conference in 10 hours but I\'m having a lot of problems.

First, I wanted to have Rails 3, so I used MacPorts to install

7条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-24 04:15

    You should use rvm as others have said to manage multiple installations of Ruby and Ruby gems. (If you go that way, take the time to read rvm's documentation carefully.)

    However, you should also get comfortable figuring out what version of Ruby your shell is seeing as the default and why. It sounds to me like your $PATH variable may not be properly updated. The $PATH variable is what determines which Ruby interpreter or gem command is the first seen, if you have more than one installed (as you now do). MacPorts will install new binaries into /opt/local/bin by default, and it should also alter your $PATH so that /opt/local/bin precedes /usr/bin (which is where Apple's out of the box Ruby lives).

    I suspect that when you did sudo gem install, you were using /usr/bin/gem (which is the gem installer for /usr/bin/ruby rather than /opt/local/bin/gem (which would be the installer for MacPort's Ruby).

    Check the output of echo $PATH, which ruby and which gem to see what's going on.

提交回复
热议问题