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
sudoto install your rvm. So, the system will requiresudopermission 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/gemerrorThe solution for this is to change ownership of all files in the
~/.rvmdirectory to current account, as if you're usingrootaccount by following command