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
That's because at some point you used
sudo
to install your rvm. So, the system will requiresudo
permission to install later gemsWhen you use command
$ sudo gem install rails -v 6.0.2.1
, you tell system to use normal directly installed ruby, not viarvm
, so it warns youNo such /user/bin/gem
errorThe solution for this is to change ownership of all files in the
~/.rvm
directory to current account, as if you're usingroot
account by following command