I’ve tried installing ruby 1.8.4 on my Mac OS X, but ruby 1.8.2 remains
my default. How do I make 1.8.4 my default?
Bob Brander wrote:
I’ve tried installing ruby 1.8.4 on my Mac OS X, but ruby 1.8.2 remains
my default. How do I make 1.8.4 my default?
Ruby 1.8.2 is installed in /usr/bin. Probably (if you took the defaults)
you installed Ruby 1.8.4 in /usr/local/bin. OS X uses the $PATH
environment variable to establish a list of directories to search for
commands. It searches the list in order. It will use the first ruby
executable that it finds in that list. So, you need to change your $PATH
to put /usr/local/bin (or whatever directory you installed Ruby 1.8.4
in) in front of /usr/bin. To see what your current $PATH is, open a
terminal window and type
echo $PATH
To put /usr/local/bin in front of /usr/bin, type
export PATH=/usr/local/bin:$PATH
Now type “ruby -v” to make sure that you get 1.8.4.
To make the change permanent you’ll have to add the “export” command
above to a startup file like .bashrc. You can read about .bashrc by
reading the bash man page.