1

I found out that I have two versions of ruby installed on OSX 10.6.2 how can I uninstall the older version and make sure that everything is fine, the path point to the other one?

bash-3.2$  /usr/local/bin/ruby -v 
ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin9.7.0]

bash-3.2$ /usr/bin/ruby -v
ruby 1.8.7 (2008-08-11 patchlevel 72) [universal-darwin10.0]


bash-3.2$ $PATH
bash: /usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/libexec: No such file or directory

bash-3.2$ whereis ruby
/usr/bin/ruby
Radek
  • 13,813
  • 52
  • 161
  • 255
  • Mac OS 10.6 installs Ruby 1.8.7 for its own use. You're free to use it, but understand that Apple put it there for a reason, and modifying or removing it could break the app it's supporting, which you probably won't realize until some point in the future when you've forgotten what you did. Try: `find /usr -name '*.rb'` to see for yourself. As recommended below, use RVM to manage your Ruby installs. – the Tin Man Mar 07 '11 at 00:49
  • To install RVM follow the directions on http://rvm.beginrescueend.com/rvm/install/ including the "Post Install" section. Also, type `rvm notes` once it is installed and install the dependencies, before installing a Ruby. – the Tin Man Mar 07 '11 at 00:54

3 Answers3

3

The version of Ruby in /usr/bin is the system-installed version, and should be left in place.

The version you have in /usr/local/bin can probably be safely removed. Was it installed using a package manager (ie, MacPorts, Homebrew?). If so, remove it using your package manager.

If you compiled and installed it manually, you can try removing the binaries from /usr/local/bin, but you may still have gems and other files lying around (most likely in /usr/local/lib/ruby.)

Alternatively, you can leave them in place and manage your Ruby environment through RVM: http://rvm.beginrescueend.com/

dnch
  • 9,565
  • 2
  • 38
  • 41
  • 1
    but the system one is older, what if I want to use newer one? – Radek Mar 06 '11 at 22:51
  • 2
    Well, you can leave them both in place, but you'll have to ensure that you're careful with specifying your paths. This is why I recommend RVM – it handles that for you. – dnch Mar 06 '11 at 22:56
2

You should locate the Ruby you're actively using with which ruby, not whereis ruby. My whereis ruby outputs /usr/bin/ruby, but which ruby gives /Users/BinaryMuse/.rvm/rubies/ruby-1.9.2-p136/bin/ruby, because I manage my Ruby versions with RVM. Since /usr/local/bin is first in your PATH, which ruby will probably return /usr/local/bin/ruby, which appears to be what you want. A quick ruby -v can confirm this too.

All that being said, I second the recommendation of using RVM to manage version of Ruby and also what RVM calls gemsets, allowing you to have "buckets" of gems that you can use one at a time. It's quite a powerful and extremely useful tool.

Michelle Tilley
  • 157,729
  • 40
  • 374
  • 311
1

You don't have to uninstall the the older version. ALternatively you can use alias like and save it in the ~/.profile file of your the OSX directory.

alias ruby="<path_to_ruby_version_that_you_want_to_use>"

That should call ruby from the proper directory that you want.

Alternatively you can use symlink like this post suggests here How to uninstall Ruby from /usr/local?. Hope it helps!

Community
  • 1
  • 1
RubyFanatic
  • 2,241
  • 3
  • 22
  • 35