4

From trying to do bundle I get:

$ gem install bundler
Fetching: bundler-1.2.0.gem (100%)
ERROR:  While executing gem ... (Errno::EACCES)
    Permission denied - /var/lib/gems

4 Answers 4

3

Add this to the bottom of .bashrc

[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"  # This loads RVM
3

Have you tried executing this as superuser?

sudo gem install bundler

Or, you could try changing the /var/lib/gems modes using chmod.

1
  • 1
    This worked for me even on MacOS Mar 25, 2019 at 11:04
3

Try this:

sudo apt-get install -y build-essential ruby ruby-dev
sudo env REALLY_GEM_UPDATE_SYSTEM=1 gem update --system
sudo gem install bundler
mkdir ~/test
cd ~/test
echo "source 'https://rubygems.org'" > Gemfile
echo "gem 'rake'" >> Gemfile
bundle install
2

I think that problem comes from the fact that the shell (in the terminal) you are running the bundler in, is not a login shell. Make it a login shell as follows:

bash --login

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .