4

I uninstalled RVM and re-installed using a single user installation using:

\curl -L https://get.rvm.io | bash -s stable

When I do bundle, it prompts for:

Enter your password to install the bundled RubyGems to your system:

I tried using the answer in "ERROR: While executing gem … (Gem::FilePermissionError)" which did not fix it.

Then, while trying to install the gem manually, I got:

Gem::InstallError: nokogiri requires Ruby version >= 1.9.2.
An error occurred while installing nokogiri (1.6.0), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.6.0'` succeeds before bundling.

then running gem install nokogiri -v '1.6.0' returned:

ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions into the /Library/Ruby/Gems/1.8 directory.

I checked all the similar posts on SO, but they didn't solve the problem. What am I missing?

Community
  • 1
  • 1
Ava
  • 5,783
  • 27
  • 58
  • 86
  • 1
    From your error message (nokogiri requires Ruby version >= 1.9.2.) you have an older Ruby version. Check your Ruby version. – cristian Aug 21 '13 at 17:26
  • Thanks, that helped me fix the problem! After updating the ruby version, I had to do few manual gem installs. Write it as an answer, I will accept. – Ava Aug 21 '13 at 17:45

3 Answers3

3

I spent a lot of time fixing this issue on my MacBook. The gem update --system does not work for me.

At last, putting the following code in the ~/.zshrc file and create a new zsh session works for me.

export GEM_HOME="$HOME/.gem"
export GEM_PATH="$HOME/.gem"
Jingpeng Wu
  • 452
  • 4
  • 6
2

after you install RVM you still need few more steps:

  1. Load RVM to the current shell:

    source ~/.rvm/scripts/rvm
    

    Usually this would not be needed if you close and open your terminal again

  2. Install ruby:

    rvm install ruby
    
  3. Use ruby:

    rvm use ruby
    

The last step is very important as your error message mentioned system ruby not the one controlled by RVM.

mpapis
  • 52,729
  • 14
  • 121
  • 158
0

Make sure to update your system rubygems with this command : sudo gem update --system --no-user-install.

bundler use it instead your local version and your bundler version could be incompatible with your system rubygems.

It works for me ;)

JoJoS
  • 1,971
  • 2
  • 13
  • 15