1. Home
  2. Ruby
  3. Write permission error when installing gems

Write permission error when installing gems


On newer v6+ platforms with support for multiple Ruby interpreters, installing a gem may fail resulting in a similar error message:

 [user@sol ~]$ gem install --no-rdoc --no-ri passenger rails
 Fetching: passenger-5.0.6.gem (100%)
 ERROR: While executing gem ... (Gem::FilePermissionError)
 You don't have write permissions for the /.socket/ruby/gems/ruby-2.1.2 directory.


The environment variable GEM_HOME is not configured until rvm use is executed Rubygems attempts to install to the system default directory, which must be reconfigured, at run-time with rvm.


Select which Ruby version to use with rvm use. This will install a rvm shim necessary to set GEM_HOME.

cd /var/www
# rvm shim is installed under /var/www
rvm use 2.2.2
# rvm will confirm this version is selected
gem install --no-rdoc --no-ri rails
# Rails installs now without incident

Updated on July 8, 2019

Was this article helpful?

Related Articles

Need Support?
Can’t find the answer you’re looking for? Don’t worry we’re here to help! If you get an error, visit https://lithiumhosting.com/support instead.
Contact Support