Skip to content

Error running rubygems setup.rb #4607

Open
@jdashton

Description

@jdashton

Description

When installing MRI 2.6.1 on macOS 10.14.4 Beta, all goes well until #installing rubygems-3.0.2. At that point I see this:

Error running 'env GEM_HOME=/ruby-2.6.1@global GEM_PATH= /Users/jdashton/.rvm/rubies/ruby-2.6.1/bin/ruby -d /Users/jdashton/.rvm/src/rubygems-3.0.2/setup.rb --no-document',
please read /Users/jdashton/.rvm/log/1549554328_ruby-2.6.1/rubygems.install.log

Steps to reproduce

  1. Install rvm master with rvm get master.

  2. Install Ruby 2.6.1 with rvm install 2.6.

Expected behavior

Ruby 2.6.1 should be cleanly installed.

Actual behavior

Installation fails with an error about running setup.rb for rubygems-3.0.2.

Environment info

ruby-2.5.3:

system:
uname: "Darwin d11442.nadadventist.org 18.5.0 Darwin Kernel Version 18.5.0: Thu Jan 31 01:17:54 PST 2019; root:xnu-4903.250.319~62/RELEASE_X86_64 x86_64"
name: "OSX"
version: "10.14"
architecture: "x86_64"
bash: "/usr/local/bin/bash => GNU bash, version 5.0.2(1)-release (x86_64-apple-darwin18.2.0)"
zsh: "/usr/local/bin/zsh => zsh 5.7.1 (x86_64-apple-darwin18.2.0)"
remote_path: "osx/10.14/x86_64"
xcode: "10.1"

rvm:
version: "1.29.7-next (master)"
updated: "58 minutes 18 seconds ago"
path: "/Users/jdashton/.rvm"
autolibs: "[4] Allow RVM to use package manager if found, install missing dependencies, install package manager (only OS X)."

ruby:
interpreter: "ruby"
version: "2.5.3p105"
date: "2018-10-18"
platform: "x86_64-darwin18"
patchlevel: "2018-10-18 revision 65156"
full_version: "ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-darwin18]"

homes:
gem: "/Users/jdashton/.rvm/gems/ruby-2.5.3"
ruby: "/Users/jdashton/.rvm/rubies/ruby-2.5.3"

binaries:
ruby: "/Users/jdashton/.rvm/rubies/ruby-2.5.3/bin/ruby"
irb: "/Users/jdashton/.rvm/rubies/ruby-2.5.3/bin/irb"
gem: "/Users/jdashton/.rvm/rubies/ruby-2.5.3/bin/gem"
rake: "/Users/jdashton/.rvm/gems/ruby-2.5.3@global/bin/rake"

environment:
PATH: "/Users/jdashton/.rvm/gems/ruby-2.5.3/bin:/Users/jdashton/.rvm/gems/ruby-2.5.3@global/bin:/Users/jdashton/.rvm/rubies/ruby-2.5.3/bin:/Users/jdashton/.rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware Fusion.app/Contents/Public:/usr/local/MacGPG2/bin:/Users/jdashton/.rvm/bin:/Users/jdashton/bin"
GEM_HOME: "/Users/jdashton/.rvm/gems/ruby-2.5.3"
GEM_PATH: "/Users/jdashton/.rvm/gems/ruby-2.5.3:/Users/jdashton/.rvm/gems/ruby-2.5.3@global"
MY_RUBY_HOME: "/Users/jdashton/.rvm/rubies/ruby-2.5.3"
IRBRC: "/Users/jdashton/.rvm/rubies/ruby-2.5.3/.irbrc"
RUBYOPT: ""
gemset: ""

Activity

Voxoff

Voxoff commented on Feb 11, 2019

@Voxoff

yup I have this on 10.14.1

mshea24

mshea24 commented on May 2, 2019

@mshea24

10.14.2 as well

galtzo

galtzo commented on Jul 10, 2019

@galtzo

This is still an issue on 10.14.5 installing ruby-2.5.3.

@mshea24 10.14.12 , perhaps you meant 10.14.2.

Here is my install log:

∴ cat /Users/pboling/.rvm/log/1562796278_ruby-2.5.3/rubygems.install.log
[2019-07-10 15:06:26] /Users/pboling/.rvm/rubies/ruby-2.5.3/bin/ruby
current path: /Users/pboling/.rvm/src/rubygems-3.0.4
GEM_HOME=/Users/pboling/.rvm/gems/ruby-2.6.3
PATH=/usr/local/opt/coreutils/bin:/usr/local/opt/pkg-config/bin:/usr/local/opt/libtool/bin:/usr/local/opt/automake/bin:/usr/local/opt/autoconf/bin:/Users/pboling/.rvm/gems/ruby-2.6.3/bin:/Users/pboling/.rvm/gems/ruby-2.6.3@global/bin:/Users/pboling/.rvm/rubies/ruby-2.6.3/bin:/Users/pboling/.rvm/bin:/Library/Frameworks/Python.framework/Versions/3.7/bin:/Applications/Postgres.app/Contents/Versions/latest/bin:~/bin:~/.bin:/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/local/git/bin:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/MacGPG2/bin:/opt/X11/bin:/Users/pboling/.ec2/tools/bin:/usr/local/share/npm/bin:/Users/pboling/Library/Python/3.7/bin:/Users/pboling/n/bin
GEM_PATH=/Users/pboling/.rvm/gems/ruby-2.6.3:/Users/pboling/.rvm/gems/ruby-2.6.3@global
command(7): env GEM_HOME=/ruby-2.5.3@global GEM_PATH= /Users/pboling/.rvm/rubies/ruby-2.5.3/bin/ruby -d /Users/pboling/.rvm/src/rubygems-3.0.4/setup.rb --no-document
Exception `LoadError' at /Users/pboling/.rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/rubygems.rb:1388 - cannot load such file -- rubygems/defaults/operating_system
Exception `LoadError' at /Users/pboling/.rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/rubygems.rb:1397 - cannot load such file -- rubygems/defaults/ruby
Exception `Gem::MissingSpecError' at /Users/pboling/.rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/rubygems/dependency.rb:310 - Gem::MissingSpecError
ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /ruby-2.5.3@global directory.
Bundler 1.17.3 installed
RubyGems 3.0.4 installed
Regenerating binstubs

Pulling the important bits out of the log, we can see GEM_HOME and GEM_PATH are set:

GEM_HOME=/Users/pboling/.rvm/gems/ruby-2.6.3
GEM_PATH=/Users/pboling/.rvm/gems/ruby-2.6.3:/Users/pboling/.rvm/gems/ruby-2.6.3@global

But the command seems to override them to very bad values:

command(7): env GEM_HOME=/ruby-2.5.3@global GEM_PATH= /Users/pboling/.rvm/rubies/ruby-2.5.3/bin/ruby -d /Users/pboling/.rvm/src/rubygems-3.0.4/setup.rb --no-document

Breaking it down further, these settings are not valid:

GEM_HOME=/ruby-2.5.3@global
GEM_PATH=

This is fundamentally the same issue as #4608

renatolond

renatolond commented on Dec 4, 2019

@renatolond

Hi! I'm also having the issue and I'm on Arch Linux.

From what I can gather, seems like a similar issue to #4287 / rubygems/rubygems#2082

Exception `LoadError' at /home/renatolond/.rvm/rubies/ruby-2.6.5-jemalloc/lib/ruby/2.6.0/rubygems.rb:1375 - cannot load such file -- rubygems/defaults/operating_system
Exception `LoadError' at /home/renatolond/.rvm/rubies/ruby-2.6.5-jemalloc/lib/ruby/2.6.0/rubygems.rb:1384 - cannot load such file -- rubygems/defaults/ruby
Exception `Gem::MissingSpecError' at /home/renatolond/.rvm/rubies/ruby-2.6.5-jemalloc/lib/ruby/2.6.0/rubygems/dependency.rb:311 - Gem::MissingSpecError
ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /home/renatolond/.rvm/gems/ruby-2.6.5-jemalloc@global directory.
Bundler 1.17.3 installed
RubyGems 3.0.6 installed
Regenerating binstubs

My GEM_PATH also seems empty:

Error running 'env GEM_HOME=/home/renatolond/.rvm/gems/ruby-2.6.5-jemalloc@global GEM_PATH= /home/renatolond/.rvm/rubies/ruby-2.6.5-jemalloc/bin/ruby -d /home/renatolond/.rvm/src/rubygems-3.0.6/setup.rb --no-document',
please read /home/renatolond/.rvm/log/1575457181_ruby-2.6.5-jemalloc/rubygems.install.log
Lukom

Lukom commented on Jan 13, 2020

@Lukom

It doesn't fix the error, but after running

rvm gemset create global --default

command ruby works as expected

dorianmariecom

dorianmariecom commented on Mar 2, 2020

@dorianmariecom

happened to me while installing ruby 2.3.1 on macos 10.15.3

mehrad-meraji

mehrad-meraji commented on Mar 3, 2020

@mehrad-meraji

happened here as well ruby 2.3.0 on macos 10.15.3

1990prashant

1990prashant commented on Mar 3, 2020

@1990prashant

Happened here as well ruby 2.3.1 on macos 10.15.1

This is the error log
Exception LoadError' at /Users/anjalichouhan/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/rubygems.rb:1241 - cannot load such file -- rubygems/defaults/operating_system Exception LoadError' at /Users/anjalichouhan/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/rubygems.rb:1250 - cannot load such file -- rubygems/defaults/ruby
Exception LoadError' at /Users/anjalichouhan/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55 - cannot load such file -- did_you_mean /Users/anjalichouhan/.rvm/src/rubygems-3.0.8/lib/rubygems/core_ext/kernel_require.rb:54:in require': cannot load such file -- openssl (LoadError)
from /Users/anjalichouhan/.rvm/src/rubygems-3.0.8/lib/rubygems/core_ext/kernel_require.rb:54:in require' from /Users/anjalichouhan/.rvm/src/rubygems-3.0.8/lib/rubygems/specification.rb:2481:in to_ruby'
from /Users/anjalichouhan/.rvm/src/rubygems-3.0.8/lib/rubygems/commands/setup_command.rb:405:in install_default_bundler_gem' from /Users/anjalichouhan/.rvm/src/rubygems-3.0.8/lib/rubygems/commands/setup_command.rb:167:in execute'
from /Users/anjalichouhan/.rvm/src/rubygems-3.0.8/lib/rubygems/command.rb:321:in invoke_with_build_args' from /Users/anjalichouhan/.rvm/src/rubygems-3.0.8/lib/rubygems/command_manager.rb:184:in process_args'
from /Users/anjalichouhan/.rvm/src/rubygems-3.0.8/lib/rubygems/command_manager.rb:148:in run' from /Users/anjalichouhan/.rvm/src/rubygems-3.0.8/lib/rubygems/gem_runner.rb:59:in run'
from setup.rb:41:in `

'

DanielRuf

DanielRuf commented on Mar 24, 2020

@DanielRuf

Any solutions? Otherwise we have to switch to a different language and framework.

deivid-rodriguez

deivid-rodriguez commented on Mar 24, 2020

@deivid-rodriguez
Contributor

If someone can provide a docker repro on a ruby that has not yet reached its end of life (ruby 2.4 or higher), I'm happy to at least have a look.

DanielRuf

DanielRuf commented on Mar 24, 2020

@DanielRuf

Switching to rbenv and testing if this works better.

DanielRuf

DanielRuf commented on Mar 24, 2020

@DanielRuf

Hm, rbenv has the same issue. Seems macOS is not great for this anymore.

rbenv/ruby-build#1169 (comment)

rotem-wald

rotem-wald commented on Apr 7, 2020

@rotem-wald

@DanielRuf Is there any new?
I did install RVM with the following guide: https://gist.github.com/denji/8706676 on macOS 10.15.4 and then installed Ruby 2.3.1. Got the same issue:

rotemwald@Rotems-MacBook-Pro ~ % rvm install 2.3.1
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.15/x86_64/ruby-2.3.1.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx.
Installing requirements for osx.
Updating system - please wait
Installing required packages: autoconf, automake, libtool, pkg-config, coreutils, libyaml, libksba, readline, zlib, openssl - please wait
Certificates bundle '/usr/local/etc/openssl@1.1/cert.pem' is already up to date.
Requirements installation successful.
Installing Ruby from source to: /Users/rotemwald/.rvm/rubies/ruby-2.3.1, this may take a while depending on your cpu(s)...
ruby-2.3.1 - #downloading ruby-2.3.1, this may take a while depending on your connection...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 13.7M  100 13.7M    0     0  96050      0  0:02:30  0:02:30 --:--:--  137k
ruby-2.3.1 - #extracting ruby-2.3.1 to /Users/rotemwald/.rvm/src/ruby-2.3.1 - please wait
ruby-2.3.1 - #applying patch /Users/rotemwald/.rvm/patches/ruby/ruby_2_3_gcc7.patch - please wait
ruby-2.3.1 - #applying patch /Users/rotemwald/.rvm/patches/ruby/2.3.1/random_c_using_NR_prefix.patch - please wait
ruby-2.3.1 - #configuring - please wait
ruby-2.3.1 - #post-configuration - please wait
ruby-2.3.1 - #compiling - please wait
ruby-2.3.1 - #installing - please wait
ruby-2.3.1 - #making binaries executable - please wait
ruby-2.3.1 - #downloading rubygems-3.0.8
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  867k  100  867k    0     0   255k      0  0:00:03  0:00:03 --:--:--  254k
No checksum for downloaded archive, recording checksum in user configuration.
ruby-2.3.1 - #extracting rubygems-3.0.8 - please wait
ruby-2.3.1 - #removing old rubygems - please wait
$LANG was empty, setting up LANG=en_US.US-ASCII, if it fails again try setting LANG to something sane and try again.
ruby-2.3.1 - #installing rubygems-3.0.8 - please wait
Error running 'env GEM_HOME=/Users/rotemwald/.rvm/gems/ruby-2.3.1@global GEM_PATH= /Users/rotemwald/.rvm/rubies/ruby-2.3.1/bin/ruby -d /Users/rotemwald/.rvm/src/rubygems-3.0.8/setup.rb --no-document',
please read /Users/rotemwald/.rvm/log/1586174803_ruby-2.3.1/rubygems.install.log
Exception `LoadError' at /Users/rotemwald/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/rubygems.rb:1241 - cannot load such file -- rubygems/defaults/operating_system
Exception `LoadError' at /Users/rotemwald/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/rubygems.rb:1250 - cannot load such file -- rubygems/defaults/ruby
Exception `LoadError' at /Users/rotemwald/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55 - cannot load such file -- did_you_mean
/Users/rotemwald/.rvm/src/rubygems-3.0.8/lib/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- openssl (LoadError)
        from /Users/rotemwald/.rvm/src/rubygems-3.0.8/lib/rubygems/core_ext/kernel_require.rb:54:in `require'
        from /Users/rotemwald/.rvm/src/rubygems-3.0.8/lib/rubygems/specification.rb:2481:in `to_ruby'
        from /Users/rotemwald/.rvm/src/rubygems-3.0.8/lib/rubygems/commands/setup_command.rb:405:in `install_default_bundler_gem'
        from /Users/rotemwald/.rvm/src/rubygems-3.0.8/lib/rubygems/commands/setup_command.rb:167:in `execute'
        from /Users/rotemwald/.rvm/src/rubygems-3.0.8/lib/rubygems/command.rb:321:in `invoke_with_build_args'
        from /Users/rotemwald/.rvm/src/rubygems-3.0.8/lib/rubygems/command_manager.rb:184:in `process_args'
        from /Users/rotemwald/.rvm/src/rubygems-3.0.8/lib/rubygems/command_manager.rb:148:in `run'
        from /Users/rotemwald/.rvm/src/rubygems-3.0.8/lib/rubygems/gem_runner.rb:59:in `run'
        from setup.rb:41:in `<main>'
DanielRuf

DanielRuf commented on Apr 7, 2020

@DanielRuf

@rotem-wald I linked a workaround. I also switched to rbenv and still use macOS 10.14.

2 remaining items

CamJN

CamJN commented on Apr 22, 2020

@CamJN
Contributor

The same is true of rubygems 3.1.1 and 3.1.0

deivid-rodriguez

deivid-rodriguez commented on Apr 22, 2020

@deivid-rodriguez
Contributor

@CamJN In the error you post, the command env GEM_HOME=/usr/local/rvm/gems/ruby-2.1.10@global GEM_PATH= /usr/local/rvm/rubies/ruby-2.1.10/bin/ruby -d /usr/local/rvm/src/rubygems-3.1.2/setup.rb --no-document is trying to install rubygems 3.1.2 on ruby 2.1. rubygems 3.1.2 does not support ruby 2.1, so I believe the rvm installer should never run such a command. Is rvm running this command?

Again, if anybody is really interested in getting this fixed, please work on providing repro steps.

Thanks!

CamJN

CamJN commented on Apr 22, 2020

@CamJN
Contributor

@deivid-rodriguez ah, well that explains my problem. I was running /usr/local/rvm/bin/rvm install ruby-$RUBY_VERSION --rubygems $RUBYGEMS_VSERSION in my CI to install a bunch of rubies and the script sets the rubygems to the latest version. Had to lock it to 3.0.8 for now. A message about known incompatible versions and then not trying to continue would have been much clearer to me FWIW.

flexid

flexid commented on Apr 25, 2020

@flexid

I bumped into the same problems and tried most of the workarounds related to this issue. Skip brew openssl workarounds, what finally got it to work was the following for ruby 2.3.1 after restarting my computer and reinstalling rvm:

rvm implode
\curl -sSL https://get.rvm.io | bash
rvm pkg install openssl
rvm install 2.3.1 --with-openssl-dir=$HOME/.rvm/usr

This was on macOS Catalina 10.15.4. Good luck!

elfotografo007

elfotografo007 commented on Apr 29, 2020

@elfotografo007

I had the same issue while trying to install ruby 2.2.2. RVM tries to install 3.0.8, but RubyGems 3.0.0+ requires Ruby 2.3. I found that the latest pre 3 Rubygems is 2.7.10. So, adding to @flexid's answer:

rvm pkg install openssl
rvm install 2.2.2 --rubygems 2.7.10 --with-openssl-dir=$HOME/.rvm/usr

This was on macOS Catalina 10.15.4.

harish-aka-shivi

harish-aka-shivi commented on May 3, 2020

@harish-aka-shivi

Thanks, @elfotografo007, It worked for me. 👍

andreibondarev

andreibondarev commented on Jun 8, 2020

@andreibondarev

@elfotografo007 Didn't work for me trying to install 2.1.10 :(

13 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @jdashton@renatolond@Lukom@mcheck@andreibondarev

        Issue actions

          Error running rubygems setup.rb · Issue #4607 · rvm/rvm