– we create awesome web applications

Once again I’ve hit a problem of installing gems on a machine with very little memory.

Gems can use quite a lot of RAM resolving dependencies and updating gem index.

It can be a problem if you have very little memory (usual condition on most cheap VPS accounts)

In my case it was an embedded device with just 235k total memory and only about 150k free.

What happens is that kernel will kill the offending process. You’ll see in the terminal something like this:

Bulk updating Gem source index for: http://gems.rubyforge.org/

The solution is to disable bulk update with -B parameter:

gem install rails -B 999999

This will take some time to run and will print a lot of dots but will use less memory.