Migrating to Snow Leopard messed up my ruby path
Since I've migrated from Leopard to Snow Leopard I get
$ ruby script/server
Rails requires RubyGems >= 1.3.2. Please install RubyGems and try again: http://rubygems.rubyforge.org
the only way to make it work is:
$ /usr/bin/ruby script/server
=> Booting Mongrel
=> Rails 2.3.8 application starting on http://0.0.0.0:3000
So I guess something got broken with my path, here is my ~/.profile file fyi:
## # DELUXE-US开发者_高级运维R-LOCAL-BIN-INSERT # (do not remove this comment) ## echo $PATH | grep -q -s "/usr/local/bin" if [ $? -eq 1 ] ; then PATH=$PATH:/usr/local/bin export PATH fi export PATH=$PATH:/opt/local/bin export MANPATH=$MANPATH:/opt/local/share/man export INFOPATH=$INFOPATH:/opt/local/share/info PATH="/usr/local/mysql/bin:$PATH" PATH="/opt/local/bin:/opt/local/sbin:$PATH" PATH="/usr/local/bin:/usr/local/sbin:$PATH" export PATH export GEMDIR=`gem env gemdir`
How can I fix this?
install RVM http://rvm.io/
Problem solved..
There is also number of other similar software: https://github.com/wayneeseguin/rvm/blob/master/help/alt.md
The last two PATH=
lines appear to be the problem. There's a Ruby in your /usr/local/bin
or /opt/local/bin
directory and it's taking precedence over the system-installed one. I'm not sure why migrating to Snow Leopard would trigger this, since I don't believe it adds those lines to the file.
Doon's recommendation of RVM is not necessary, but it is a really handy tool.
精彩评论