开发者

I have too many versions of Ruby and Rails

开发者 https://www.devze.com 2023-04-12 15:14 出处:网络
I have both ruby and rails installed in: /usr/local/bin/ruby /usr/bin/ruby /usr/local/bin/ruby This开发者_JAVA百科 is causing problems when I try to run certains commands like ruby script/console

I have both ruby and rails installed in: /usr/local/bin/ruby /usr/bin/ruby /usr/local/bin/ruby

This开发者_JAVA百科 is causing problems when I try to run certains commands like ruby script/console

How do I remove some of these installations of both ruby and rails?


RVM will help you for sure. Check out RVM here


Preventing this kind of situations is the very role of RVM and it's gemsets.

I encourage you to check it out.


There are a few options. First one would be to get your ruby system install in good order. There is no harm in renaming removing those multiple ruby file in your diverse bin folders. Get the stable release of 1.9.2 and gem install whatever you need then. Googling around to fill the gaps you may have here

Quick and dirty you can do:

Get the latest stable release of ruby 1.9.2, compile it on your system, I suppose the ruby that is under /usr/bin is the system's and you are using macosx. The one located in /usr/local/bin is probably something you installed yourself and even maybe you don't even need to reinstall ruby 1.9.2. If that's so get you .bashrc in proper order by making sure /usr/local/bin comes before /usr/bin and you won't have to worry so much about which version you might be using. Create a ~/.bash_profile and put this in.

export PATH="/usr/local/bin:$PATH"

Expected output (more or less):

/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/texbin

Others mentioned RVM. I used it, but I don't use it on a production server, I prefer a single sane ruby install to RVM. There is also rbenv and is seems much saner.

Final thought play around in your system remove symlink stuff, set your PATH variable or use RVM/rbenv.


Managing Ruby: Moving From RVM to rbenv

It's time to switch over, http://cantina.co/2011/10/08/managing-ruby-moving-from-rvm-to-rbenv/

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号