Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm attempting to install the latest stable version of Ruby (1.9.2) on OS X 10.6.4.

The installation was successful, but the 'ruby' command is still erroneously referencing the previous installation. I've removed the ruby symlink from /usr/bin/ (left the installed frameworks alone). Here are the results of a few commands:

> which ruby
/usr/local/bin/ruby

> ruby --version
-bash: /usr/bin/ruby: No such file or directory

> /usr/local/bin/ruby --version
ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-darwin10.4.0]

I'm confused as to why which ruby and ruby --version seem to be referencing different file paths. I think I'm missing one basic step here. Any ideas?

share|improve this question
    
Is there a shell alias or function or something like that defined, that is invisible to which but which is called instead? –  Daniel Beck Nov 17 '10 at 19:27

3 Answers 3

Best way to have multiple ruby version is to use rvm. after installing rvm you can install multiple ruby version simply by

rvm install 1.8.7
rvm install 1.9.2
rvm install jruby

switching is even more easy, type (in terminal)

rvm use 1.8.7 --default #to use rvm for this terminal session and also sets ruby 1.8.7 as default ruby version
ruby -v #should give ruby version set for current session
ruby use 1.9.2 #sets different ruby to be used for this session

for complete installation instruction see here

share|improve this answer
up vote 0 down vote accepted

Answer: I left the default ruby installation alone, just deleted the symlink, then navigated to the destination of the symlink to see what was there. When I was running my commands, I was still in the ruby.framework directory, so the call to ruby --version was referencing the local folder copy of ruby, not the one associated with which.

share|improve this answer
    
srsly? this is a desperate attempt to build rep –  hbdgaf Nov 18 '10 at 4:31
    
@aking1012 Of course not. It was a mysterious problem caused by a silly mistake. –  kubi Nov 18 '10 at 13:56

add a soft link in /usr/bin for ruby is one solution...another is to make sure usr/local/bin appears first in your $PATH

share|improve this answer
    
to me, it looks like a slightly misconfigure mac port or an attempt to make the OS find 1.8 first if both are installed...alternately you could use rvm. that's what i use to manage multiple concurrent ruby installs: blog.bridgeutopiaweb.com/post/… –  hbdgaf Nov 17 '10 at 13:18
    
That's what I plan on doing. Any idea why ruby and which ruby are referencing different paths? I had always thought the would point to the same path. –  kubi Nov 17 '10 at 14:24
    
which just looks for the file...ruby may have been compiled with a hard-coded location if some environment variables are not set namely $RUBY_HOME i think –  hbdgaf Nov 17 '10 at 22:40

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.