I’ve been fighting a problem updating Rubygems on a 256MB VPS.
Everytime I run ‘gem update’ or ‘gem install’ the program would consume over 80% of the server’s memory.
Thankfully, I found a comment from Rob Kaufman who suggested using the -B argument.
Example
gem install rails -B 1000000