From: Timothy Hunter Date: 2007-01-22T03:27:12+09:00 Subject: Re: uninstalling the mac tiger version of ruby libsfan01 wrote: >> You'll probably get "ruby 1.8.5" >> >> > > Yes it seems to be the case that its looking for the wrong version. > timothy how can i change the setting of the path variable so that the > latest version is accessed? (from "usr/bin/ruby" to > "usr/local/bin/ruby")? > > thanks > > marc > > PATH is an environment variable that the bash shell uses when it searches for a command. In bash you set environment variables like this: export VAR=value Notice there's no leading $ in the name when it's on the left-hand side of the assignment. When you want to get the value of an environment variable you precede its name with a $. Now, you want to prepend /usr/local/bin to the current value of PATH. Enter this command: echo $PATH This will show you the current value of PATH. Then enter: export PATH=/usr/local/bin:$PATH (Directories in the PATH are separated by colons.) issue "echo $PATH" again to ensure that the change worked. Now enter "ruby -v". You should see "ruby 1.8.5" because OS X found ruby in /usr/local/bin. Of course you don't want to have to redefine your PATH variable every time you open a terminal. To get your PATH set the way you want it every time you can add this command to a bash configuration script. The bash shell gets its configuration from a number of scripts. I believe the preferred one for this sort of thing is .bash_profile. The bash shell looks for this file in your home directory. You may already have such a file. If so, save a backup copy, open it in a text editor and add the command on a separate line. If the file doesn't already exist, create it and add these two lines: #! /bin/bash export PATH=/usr/local/bin:$PATH Save the file, close the terminal window and open a new one. Issue "echo $PATH" again to see your changed PATH. Issue "ruby -v" and ensure that you're getting "ruby 1.8.5". Warning: be careful. If you screw up your path many things in OS X will stop working. If you encounter problems (like commands not working) just delete your .bash_profile (or restore it to its previous state) and try again. Always close the terminal window and open a new window after making a change. For more info search for bash on the web or issue the "man bash" command in a terminal window.