I am playing a bit with Rails on Archlinux. and the first command I ran errored on me:
% rails new Site ... ... ... run bundle install Fetching gem metadata from https://rubygems.org/........... Fetching gem metadata from https://rubygems.org/.. Errno::EACCES: Permission denied - /usr/lib/ruby/gems/1.9.1/cache An error occurred while installing rake (10.0.2), and Bundler cannot continue. Make sure that `gem install rake -v '10.0.2'` succeeds before bundling.
I do have ‘rake 10.0.2’ installed but I also have ‘rake 0.9.2.2’ because Archlinux bundles it with the Ruby package. I struggled to find a way to tell Rails to use the newer package.
The solution turned to be quite easy. Just set the GEM_HOME environment variable to where your gems are installed. For example:
If you want it to be persistent add it to a file which is sourced every time you log in, like for zsh you can add to the file /home/username/.zshenv :
Now it will work:
% rails new Site ... ... ... Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.