Installing a gem locally is extremelly easy if you follow the steps below. I was recently in a situation where I had to upgrade a gem quickly to resolve a bug but the latest version of the gem located on http://gems.rubyforge.org was older than what was necessary. You need to locate the .gem file for the gem that needs to be installed and get a copy on the local server. In my case I happened to have a gem server that had ben installed but the web access was down at the moment so I SCP’d (secure copy) it to the local server and placed it in /usr/local/src.
Once you have the gem moved onto the local server issue the below command to install.
- gem install --no-test --install-dir /usr/local/lib/ruby/gems/1.8 ruleby-0.4.1.gem
In the example above I issued this command from the /usr/local/src directory where the gem source was located. The gem I was installing is called ruleby and the directory I needed it installed where my other gems are already installed was /usr/local/lib/ruby/gems/1.8/.
To verify your gem installed properly use the “gem list” command and in this case one of the gems you would now see in the list is “ruleby (0.4.1)”.