Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
share|improve this question
up vote 3 down vote accepted

Add this to the bottom of .bashrc

[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"  # This loads RVM
share|improve this answer

Have you tried executing this as superuser?

sudo gem install bundler

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

share|improve this answer

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 ''" > Gemfile
echo "gem 'rake'" >> Gemfile
bundle install
share|improve this answer

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

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.