So I've read every post on how to stop sudo installing gems and there's literally 100's of different answers and one still hasn't struck as gold yet. Can someone, once and for all, offer the most simple and concise manner in which to edit and update your bash profile to rewrite permissions and stop sudo installing gems?
Below is just an example to show you what I get every time. For the past few weeks, I've just been doing everything and I know this is putting a band-aid over the problem.
LMagnotti$ gem install nokogiri
ERROR: While executing gem ... (Errno::EACCES)
Permission denied @ rb_sysopen - /usr/local/lib/ruby/gems/2.3.0/gems/nokogiri-1.6.7.2/.autotest
In order to stop installing ruby gems from sudo just use rvm
or rbenv
apps, they allow to mount system rubies, otherwise all the gems will be installed to system folder since rubygem
app is also installed to system. That is proper way to use gems for each project, but also you can specify in ~/.gemrc another folder in your home or in var/ folder:
gem: --no-rdoc --no-ri
gemhome: /var/ruby/1.8/gem_home
gempath:
- /usr/ruby/1.8/lib/ruby/gems/1.8