2

I installed ruby 2.6.3 using RVM. later when i try to install rails i am getting following error.

$ gem install rails -v 6.0.2.1

ERROR: While executing gem ... (Gem::FilePermissionError) You don't have write permissions for the /usr/local/rvm/gems/ruby-2.6.3 directory.

$ sudo gem install rails -v 6.0.2.1

sudo: unable to execute /usr/bin/gem: No such file or directory

Surya Teja
  • 83
  • 5

1 Answers1

0

That's because at some point you used sudo to install your rvm. So, the system will require sudo permission to install later gems

When you use command $ sudo gem install rails -v 6.0.2.1, you tell system to use normal directly installed ruby, not via rvm, so it warns you No such /user/bin/gem error

The solution for this is to change ownership of all files in the ~/.rvm directory to current account, as if you're using root account by following command

sudo chown -R $USER ~/.rvm
quyetdc
  • 1,485
  • 1
  • 14
  • 24