0

Ruby, RubyGems, Synaptic and setting paths

I wrote an older article on installing ruby 1.9.2 in Ubuntu. This initially worked fine for me, but recently I started getting random issues across three different pc’s. I gave up trying to solve the issues in the end and decided I’d revert to using ruby provided by synaptic (1.8.6, so it’s all properly package managed). I went through the pain of removing the installed ruby 1.9.2, then proceeded to install ruby via synaptic.

sudo apt-get install ruby rubygems
sudo gem install rake

Right, all installed? Not quite. Any gems that I installed, for example “rake” would result in a “command not found” when used in the terminal. My ruby path, and gem path weren’t correct. This however was easy to fix.

sudo gedit $HOME/.bashrc

This will open up an editor. You may not may not have a .bashrc file already. Make sure you save the changes regardless. Inside the file paste the following:

export PATH=/var/lib/gems/1.8/bin:$PATH
export GEM_PATH=/var/lib/gems/1.8

Open a terminal window, and you should now be able to use any of your gems.

Related Posts