FreedomCoder Information for free-minded geeks

28Feb/105

Where are gem’s executables in Ubuntu?

As you might know, I'm always working on new projects to automate my work. Call me lazy, call me smart, but the true is that I actually enjoy programming, and if helps making my life easier, it is more than welcomed ;)

Whenever I do a new gem I try to test it on as many platforms as I can.  OSX is the default development platform so usually they always work there, then I try on Gentoo, Fedora, Windows and Ubuntu.

I usually run into problems when I have to find where does Ubuntu saves the gem files and binaries. Yes, you will search pretty much everywhere but you won't remember where the hell they are.

Since I got tired of searching every time I test something on an ubuntu VM, here is a short how-to so I won't have to search next time.

Google Search: "can't find gem executables in ubuntu"

or
$ sudo gem environment
RubyGems Environment:
- RUBYGEMS VERSION: 1.3.5
- RUBY VERSION: 1.8.7 (2009-06-12 patchlevel 174) [i486-linux]
- INSTALLATION DIRECTORY: /var/lib/gems/1.8
- RUBY EXECUTABLE: /usr/bin/ruby1.8
- EXECUTABLE DIRECTORY: /var/lib/gems/1.8/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86-linux
- GEM PATHS:
- /var/lib/gems/1.8
- /home/USER/.gem/ruby/1.8
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- :sources => ["http://gems.rubyforge.org/", "http://gems.github.com"]
- REMOTE SOURCES:
- http://gems.rubyforge.org/
- http://gems.github.com

As it is shown above, my Ubuntu installation saves all installed gems in  ~/.gems or /var/lib/gems/1.8. Once you have the path, all you have to do is add them to your shell rc file.

In the case you use bash or zsh:

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

or, if you already have a PATH like i do just add it to the declaration

PATH=/usr/bin:......:/var/lib/gems/1.8/bin

re open your shell and EUREKA, all your gem's executable are now in your path.