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.
I recently upgraded from OS X Snow Leopard to Lion (also upgraded Xcode to 4.2)
Everything worked just fine for a while
Today I decided to install some gems (RSpec, Cucumber), and I started getting date format warnings whenever I did anything with RubyGems
I decided to update RubyGems, from 1.3.6 (I'm not sure here) to current 1.8.11
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)
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.
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.
gem install rubyzip -v '0.9.4' gives the above mentioned error
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>'
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)
I'm out of ideas, what can I do?
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 :)
Related
On Linux Mint 17.3, I upgraded from Ruby 1.9.2 to Ruby 2.3.0 using RVM, and now the 'gem' CLI and every Ruby program that uses gems are returning the following error:
<internal:gem_prelude>:1:in require': cannot load such file -- rubygems.rb (LoadError)
from <internal:gem_prelude>:1:in'`
I have tried reinstalling Ruby, switching to other versions (including back to 1.9.2), reinstalling RVM, and rvm fix-permissions, none of which have changed the error.
Any idea what's going on here?
EDIT: I was able to get CLI functionality back seemingly by repeatedly reinstalling 2.3.0 (rvm reinstall rather than uninstalling and reinstalling manually). However, programs that require gems are still breaking with the same error.
The below might help:
gem install rubygems-update
update_rubygems
If nothing helps, try to manually remove 1) all rubies from RVM and 2) rvm directory:
rm -rf /home/[username]/.rvm
and reinstall RVM from the scratch.
So, it seems like ruby isn't able to find gems that are installed? The error:
/Users/userName/.rbenv/versions/2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in
`require': cannot load such file -- activesupport (LoadError)
from /Users/userName/.rbenv/versions/2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in
`require'
from test.rb:3:in `<main>'
I had ruby installed via RVM and brew on my Mac (El Capitan). I don't remember what I had done when I started getting this error when trying to run my ruby program. At the top of my program I have require 'json' and require 'rest-client', and require 'activesupport' Nothing abnormal there.
After a lot of googling, I ended up doing rvm implode and removing the .rvm files from my computer to completely uninstall rvm. I then tried installing ruby via brew, but was getting the same error. I then uninstalled the the brew version of ruby, and installed with rbenv. Still got the same error, but this time with the rbenv path to the kernal_require.rb file instead of the brew or rvm paths that it had showed before.
So something tells me that this is not something to do with rvm or brew or rbenv because I was getting the same error with the versions of ruby I tried for each one. The gems are installed. Why isn't it able to load them? Uninstalling and reinstalling the gems didn't help. I had to reinstall them anyway every time I uninstalled and reinstalled ruby.
gem env home returns this:
/Users/userName/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0
brew config returns this for ruby:
Ruby: /Users/userName/.rbenv/shims/ruby => /Users/userName/.rbenv/versions/2.3.0/bin/ruby
I have these included in my PATH:
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
ruby -v returns this:
ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin15]
I've checked for spaces in the file path, I've tried installing bundler and installing gems that way, but I'm still getting the same issue. What else can I look at to solve this problem?
You use
gem 'activerecord'
in the gemfile.
require 'active_support/all'
is used in the program.
It's slightly annoying when gems do this, but you can't always assume the files you require have the same name as in the Gemfile.
Unfortunately, I recently upgraded the system Ruby to 2.3 on my Mac. Since I have to use Cocoapods 0.39 for a specific project which does not properly work, I would like to use an older version of Ruby. For this purpose, I installed RVM and then switched to ruby-2.2-head:
> \curl -sSL https://get.rvm.io | bash -s stable --ruby
> rvm install 2.2-head
> rvm use 2.2-head --default
This worked fine. Then I tried to install Cocoapods and got the usual error message:
> rvmsudo gem install cocoapods
Warning: can not check `/etc/sudoers` for `secure_path`, falling back to call via `/usr/bin/env`, this breaks rules from `/etc/sudoers`. Run:
export rvmsudo_secure_path=1
to avoid the warning, put it in shell initialization file to make it persistent.
In case there is no `secure_path` in `/etc/sudoers`. Run:
export rvmsudo_secure_path=0
which I silenced by chosing the second option. Then I checked Cocoapods and got a fantastic error message:
> pod --version
/Users/bastian/.rvm/rubies/ruby-2.2-head/lib/ruby/site_ruby/2.2.0/rubygems.rb:250:in `find_spec_for_exe': can't find gem cocoapods (>= 0.a) (Gem::GemNotFoundException)
from /Users/bastian/.rvm/rubies/ruby-2.2-head/lib/ruby/site_ruby/2.2.0/rubygems.rb:278:in `activate_bin_path'
from /Users/bastian/bin/pod:22:in `<main>'
Furthermore, Cocoapods is not listed with the following command:
> gem list
*** LOCAL GEMS ***
bigdecimal (1.2.6)
io-console (0.4.3)
json (1.8.1)
psych (2.0.8)
rake (10.4.2)
rdoc (4.2.0)
Cocoapods seems to be installed into the wrong directory:
> which pod
/Users/bastian/bin/pod
So if I switch back to the system Ruby, the pod --version command returns 0.39.0.
I guess that somehow Cocoapods was not installed with the RVM Ruby but rather with the system version. What did I do wrong?
With the help of "How to get RVM to set correct gem path" I was able to solve the problem. I don't know why but the removal of the single entry --user from .gemrc solved this problem for me. Since the file only contained this one line I just renamed it and reinstalled Cocoapods:
> mv ~/.gemrc ~/.gemrc_backup
> gem install cocoapods`
Now Cocoapods is working again as it resides at the correct path:
> which pod
/Users/bastian/.rvm/gems/ruby-2.2-head/bin/pod
When attempting to run any rake, rails or bundle commands, I get following error:
/home/username/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': libcrypto.so.1.0.0: cannot open shared object file: No such file or directory - /home/username/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/x86_64-linux/digest/sha1.so
I have tried rvm pkg install openssl, rvm remove 1.9.3, rvm reinstall 1.9.3, reinstall bundler and all gems. I read on another forum that I may have to uninstall rvm, ruby and rails and start from scratch. Ugh - really?
Thanks in advance.
you need to read and follow the instructions displayed with:
rvm requirements
then remove the rvm installed openssl:
rm -rf $rvm_path/usr/
and reinstall ruby:
rvm reinstall 1.9.3-p194
I've just installed RVM on a new ubuntu 10.04 LTS server and one ruby, 1.9.2-p180. I've made a new gemset in my project folder, which has a Gemfile. I realised that in order to install the gems in the gemfile, i need to install bundler, so i did
gem install bundler
but, i get this error:
ERROR: Loading command: install (LoadError)
no such file to load -- zlib
ERROR: While executing gem ... (NameError)
uninitialized constant Gem::Commands::InstallCommand
I googled around a bit and tried this:
rvm pkg install zlib
which installed ok but didn't solve the problem. I also tried installing the rake gem but got the same error trying to do that.
Kind of stuck...any suggestions? thanks, max
EDIT - btw, i can install the bundler gem fine outside of rvm, ie using system ruby.
EDIT2 - I got past this problem by removing the version of ruby, then installing it again with zlib:
rvm remove 1.9.2-p180
rvm install 1.9.2-p180 -C --with-zlib-dir=$rvm_path/usr
Now i can install bundler and all my gems ok. Hooray. Except, when i try to open my rails env (with rails s, rails c or rake db:create) i get this fatal error:
/home/max/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/
1.9.1/rubygems/custom_require.rb:36:in `require':
/lib/libz.so.1: version `ZLIB_1.2.3.3' not found (required by
/home/max/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/i686-linux/zlib.so) -
/home/max/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/i686-linux/zlib.so (LoadError)
So, still not out of the woods zlib-wise. I don't know why zlib is causing such problems, any ideas?
Sorted it!
Running locate libz gives me
/home/max/.rvm/src/zlib-1.2.5/libz.a
/home/max/.rvm/src/zlib-1.2.5/libz.so
/home/max/.rvm/src/zlib-1.2.5/libz.so.1
/home/max/.rvm/src/zlib-1.2.5/libz.so.1.2.5
/home/max/.rvm/usr/lib/libz.a
/home/max/.rvm/usr/lib/libz.so
/home/max/.rvm/usr/lib/libz.so.1
/home/max/.rvm/usr/lib/libz.so.1.2.5
/lib/libz.so.1
/lib/libz.so.1.2.3.3
I just noticed that the version of libz in lib is 1.2.3.3 while the version i installed with rvm is 1.2.5. Is this the problem perhaps? In the /lib folder, zlib.so.1 is symlinked to it's neighbour file libz.so.1.2.3.3.
I tried symlinking it to /home/max/.rvm/usr/lib/libz.so.1.2.5 instead:
sudo rm /lib/libz.so.1
sudo ln -s /home/max/.rvm/src/zlib-1.2.5/libz.so.1 /lib/libz.so.1
and, that seems to have worked... i still don't really understand exactly what went wrong, though, so would welcome a more insightful solution/explanation :)