errno::EPERM for rubygems setup

Rán's Avatar


10 Dec, 2017 06:17 AM

Hi guys,
I'm incredibly new to Ruby, and that includes installing rubygems in order to install gems themselves. I cloned the github repository properly and was able to update the bundler submodule just fine, but every time I go to run ruby setup.rb I get the following:

Ran-sin-MacBook-Pro:rubygems ran$ ruby setup.rb ERROR: While executing gem ... (Errno::EACCES) Permission denied @ rb_sysopen - /Library/Ruby/Site/2.3.0/rubygems.rb`

so naturally I tried with sudo and got this:

Ran-sin-MacBook-Pro:rubygems ran$ sudo ruby setup.rb ERROR: While executing gem ... (Errno::EPERM) Operation not permitted @ rb_sysopen - /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/gem

any ideas or fixes?

  1. 1 Posted by Rán on 10 Dec, 2017 07:01 AM

    Rán's Avatar

    Update: I also can't install it with RVM.

    Got this:
    Ran-sin-MacBook-Pro:~ ran$ rvm rubygems latest system - #downloading rubygems-2.6.14 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 751k 100 751k 0 0 97k 0 0:00:07 0:00:07 --:--:-- 96075 No checksum for downloaded archive, recording checksum in user configuration. system - #extracting rubygems-2.6.14.... system - #removing old rubygems......... $LANG was empty, setting up LANG=en_US.US-ASCII, if it fails again try setting LANG to something sane and try again. system - #installing rubygems-2.6.14. Error running 'env GEM_HOME=/Users/ran/.rvm/gems/system@global GEM_PATH= /Users/ran/.rvm/rubies/system/bin/ruby -d /Users/ran/.rvm/src/rubygems-2.6.14/setup.rb --no-document', please read /Users/ran/.rvm/log/1512888146_system/rubygems.install.log

    And when I open the log, it says this:

    [2017-12-09 21:42:26] /Users/ran/.rvm/rubies/system/bin/ruby current path: /Users/ran/.rvm/src/rubygems-2.6.14 PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/ran/.rvm/bin command(7): env GEM_HOME=/Users/ran/.rvm/gems/system@global GEM_PATH= /Users/ran/.rvm/rubies/system/bin/ruby -d /Users/ran/.rvm/src/rubygems-2.6.14/setup.rb --no-document env: /Users/ran/.rvm/rubies/system/bin/ruby: No such file or directory

  2. 2 Posted by Inder on 23 Dec, 2017 06:59 AM

    Inder's Avatar

    Same error for me too. Please somebody.. need help..

  3. 3 Posted by Rán on 24 Dec, 2017 11:10 AM

    Rán's Avatar

    Inder, I was able to fix this by reclaiming ownership using sudo chown -R $(whoami) ~/Library

    if that doesn't help, try this:

    sudo chown -R $(whoami) ~/Library/Ruby

  4. Support Staff 4 Posted by kerrizor on 06 Mar, 2018 11:47 PM

    kerrizor's Avatar

    Appears to have solved itself! In general, though, we can't offer more than rudimentary technical support for individual issues.

  5. kerrizor closed this discussion on 06 Mar, 2018 11:47 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac