Bundling rails apps on managed server

On a managed server where you do not have root access, but still would like to install some gems manually, you can install them locally – as in install them in your own user directory.

This can easily be done with the following command:
gem install somegem -v'1.2.3' -i ~/mygems

Then, the newly installed gems (now reciding in ~/mygems/cache) may be copied to the vendor/cache folder of your rails app:

cd ~/path/to/rails/app
cp ~/mygems/cache/* vendor/cache/
bundle install --local

Why am I writing this? Because the last time my hosting provider updated the FreeBSD OS, I could not simply run bundle install, Instead I had to fetch some specific version of libv8 to get it all to work. There may be other ways – but this is what I found to work in my case.

Another note to self: The RubyRacer is quite stubborn with dependencies. You may want to try bundle update libv8 before going crazy with other stuff 🙂