Forum: Ruby making 1.8.4 default

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
56bd55778571ad185109cab84588c92f?d=identicon&s=25 Bob Brander (Guest)
on 2006-05-26 09:08
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?
B33ea5c12d767bfd1253940a960274f5?d=identicon&s=25 Tim Hunter (timhunter)
on 2006-05-26 14:03
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.
This topic is locked and can not be replied to.