Fix your PATH
Get rid of those aliases. Remove them from the bash_profile
. First of all, check your path.
echo $PATH
Here, /usr/local/bin
should take precedence over /usr/bin
. If this isn't the case, something is wrong. Try if the following works, when you add this line to ~/.bash_profile
:
export PATH=/usr/local/bin:$PATH
Save it, open a new shell and run
which -a ruby
Now you should see that /usr/local/bin/ruby
is used, whereas /usr/bin/ruby
comes second (this is the default ruby 1.8.7 of OS X).
Alternative: Install RVM
For a better Ruby experience I would recommend you remove the Homebrew installation of Ruby altogether and install RVM, the Ruby Version Manager. Why? Because it allows you to switch between your locally installed Rubies and Gems.
Install git
over Homebrew if you haven't already. Then:
bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)
After the installation, add RVM to your ~/bash_profile
by entering the following into a terminal:
echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.bash_profile
Finally, open a new Terminal window and check if RVM works:
type rvm | head -1
This should output "rvm is a function". You can then proceed to install Rubies:
rvm install 1.9.2
Note: For any further instruction type following in command line
rvm notes
This will give you comprehensive notes on what's and how's.
When this is done, you can set it as default:
rvm --default use 1.9.2
Best Answer
Normally under Ubuntu you need to do:
That will allow you to set the default to any available version of ruby installed on your system. This is easily installed from repositories.