Question

TL;DR:

$ gem install rubyzip 
ERROR:  While executing gem ... (Errno::EPERM)
    Operation not permitted - /Users/darth/.rvm/gems/ruby-1.9.2-p136/gems/rubyzip-0.9.4/README

And now in detail. I'm not sure which information is relevant, so I'm just gonna say it all.

  1. I recently upgraded from OS X Snow Leopard to Lion (also upgraded Xcode to 4.2)
  2. Everything worked just fine for a while
  3. Today I decided to install some gems (RSpec, Cucumber), and I started getting date format warnings whenever I did anything with RubyGems
  4. I decided to update RubyGems, from 1.3.6 (I'm not sure here) to current 1.8.11
  5. The warning kept on popping up, so I tried to remove the gemset with rvm gemset empty, which also failed, because of some permission denied error (yes stupid me didn't write it down)
  6. In result of that, I reinstalled Ruby via rvm remove 1.9.2 and rvm install 1.9.2 (I didn't forget to rvm use 1.9.2 --default after that.
  7. I installed bundler gem install bundle and then tried to bundle install in my Rails 3.1.1 project, but it ends with error

    Installing rubyzip (0.9.4) 
    Errno::EPERM: Operation not permitted - /Users/darth/.rvm/gems/ruby-1.9.2-p136/gems/rubyzip-0.9.4/README
    An error occured while installing rubyzip (0.9.4), and Bundler cannot continue.
    Make sure that `gem install rubyzip -v '0.9.4'` succeeds before bundling.
    
  8. gem install rubyzip -v '0.9.4' gives the above mentioned error

  9. The README file says to download source and install from there via ruby install.rb, which also ends in error

    $ ruby install.rb 
    /Users/darth/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/fileutils.rb:841:in `install': wrong number of arguments (4 for 3) (ArgumentError)
    from install.rb:21:in `block in <main>'
    from install.rb:18:in `each'
    from install.rb:18:in `<main>'
    
  10. Even executing tests fro rubyzip ends up in bunch of errors

    $ rake test
    rake/gempackagetask is deprecated.  Use rubygems/package_task instead
    rake/rdoctask is deprecated.  Use rdoc/task instead (in RDoc 2.4.2+)
    /Users/darth/.rvm/rubies/ruby-1.9.2-p136/bin/ruby -C test alltests.rb
    <internal:lib/rubygems/custom_require>:29:in `require': no such file to load -- stdrubyexttest (LoadError)
    from <internal:lib/rubygems/custom_require>:29:in `require'
    from alltests.rb:5:in `<main>'
    rake aborted!
    Command failed with status (1): [/Users/darth/.rvm/rubies/ruby-1.9.2-p136/b...]
    
    Tasks: TOP => test
    (See full trace by running task with --trace)
    
  11. I'm out of ideas, what can I do?

Was it helpful?

Solution

I'm really not sure what caused this, but I managed to fix it by doing the following.

Since reinstalling Ruby 1.9.2 didn't help, I decided to be even more drastical and went down to rvm. I found out that I had version 1.1.something installed, which is about 9 months old.

I tried to update, but it didn't help, so rvm implode did the trick. I even had to sudo rm -rf ~/.rvm, probably because I managed to mess up some gem installs by adding sudo to them.

After reinstalling rvm and reinstalling 1.9.2, it seems like everything is working fine now, even with Xcode 4.2.

Lesson learned, rm -rf & reinstall is better than trying to upgrade from a year old version :)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top