2

Im using Ubuntu 15.10. This is the code I write in the terminal

gem install bundler
ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /var/lib/gems/2.1.0 directory.

Why is it trying to install it there? of course it doesn't have permissions to install it in the root directory. If I try the same command like this sudo gem install bundler it works. But it is not supposed to be installed as sudo, it gives me problems when creating a new Rails app. What should I do?

Alejandro Veintimilla
  • 10,743
  • 23
  • 91
  • 180

1 Answers1

7

You should probably start by running gem env and look at your default environment.

You can change the default installation directory by exporting a different GEM_HOME:

export GEM_HOME=$HOME/.gem/
Community
  • 1
  • 1
Mike K.
  • 3,751
  • 28
  • 41