gem environment change installation directory code example
Example 1: gem install to a different directory linux
$ gem install --install-dir /path/to/gems/folder foo
Example 2: gem install to a different directory linux
export GEM_HOME=~/projects/shared/gems/ruby/1.8/gems