Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install fails on Mojave #4608

Open
marcandre opened this issue Feb 7, 2019 · 25 comments
Open

Install fails on Mojave #4608

marcandre opened this issue Feb 7, 2019 · 25 comments

Comments

@marcandre
Copy link

marcandre commented Feb 7, 2019

Description

I'm having issues installing many versions of Ruby on my mac newly updated to Mojave.

Install gist: https://gist.github.com/marcandre/1cf51577ed11a95b71a72c01c057f132
Log gist: https://gist.github.com/marcandre/3bf7fda62b1e6c979e0b018ebdb09372

I'm clueless as to what is going on; the 3 exception make no sense to me.

Environment info

$ rvm info

system:

  system:
    uname:        "Darwin malr.attlocal.net 18.2.0 Darwin Kernel Version 18.2.0: Mon Nov 12 20:24:46 PST 2018; root:xnu-4903.231.4~2/RELEASE_X86_64 x86_64"
    name:         "OSX"
    version:      "10.14"
    architecture: "x86_64"
    bash:         "/usr/local/bin/bash => GNU bash, version 5.0.0(1)-release (x86_64-apple-darwin18.2.0)"
    zsh:          "/bin/zsh => zsh 5.3 (x86_64-apple-darwin18.0)"
    remote_path:  "osx/10.14/x86_64"
    xcode:        "10.1"

  rvm:
    version:      "1.29.7-next (master)"
    updated:      "3 hours 35 minutes 37 seconds ago"
    path:         "/Users/mal/.rvm"
    autolibs:     "[enable] Allow RVM to use package manager if found, install missing dependencies, install package manager (only OS X)."

  homes:
    gem:          "not set"
    ruby:         "not set"

  binaries:
    ruby:         "/usr/local/bin/ruby"
    irb:          "/usr/bin/irb"
    gem:          "/usr/bin/gem"
    rake:         "/usr/bin/rake"

  environment:
    PATH:         "/usr/local/opt/openssl@1.1/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Applications/VMware Fusion.app/Contents/Public:/opt/X11/bin:/Users/mal/.ec2/api/bin:/Users/mal/ruby/dev/spec/mspec/bin:/Users/mal/.bin:/usr/local/Cellar/node/6.8.1/bin:/usr/local/bin:/Users/mal/.rvm/bin"
    GEM_HOME:     ""
    GEM_PATH:     ""
    MY_RUBY_HOME: ""
    IRBRC:        ""
    RUBYOPT:      ""
    gemset:       ""
@marcandre
Copy link
Author

Installing 2.6.1 / 2.4.5 produce same failure and errors in the log file.

@pkuczynski
Copy link
Member

The issue seems to be connected with installing rubygems, and not ruby itself:

ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /ruby-2.5.1@global directory

Can you check this?

@marcandre
Copy link
Author

Sorry, but where is the /ruby-2.5.1@global directory??

@marcandre
Copy link
Author

AFAIK, everything is contained within ~/.rvm/rubies/ruby-2.5.1 which was created by rvm and is drwxr-xr-x with my user and group.

@kelvinmatheus
Copy link

I started to have the same problem after updating RVM. I will be following this issue. I am using macOS Mojave.

Thanks.

@kelvinmatheus
Copy link

kelvinmatheus commented Feb 8, 2019

Hey, I tried the following and it worked for me:

Error:

ERROR: While executing gem ... (Gem::Exception) Unable to require openssl, install OpenSSL and rebuild Ruby (preferred) or use non-HTTPS sources

# Delete rvm
$ rvm implode

# Install RVM
$ gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 && \curl -sSL https://get.rvm.io | bash -s stable
#  Checked if there is no ruby version installed
$ rvm list
Warning! PATH is not properly set up, /Users/kelvinfirmino/.rvm/gems/ruby-2.2.3@myenergyxpert/bin is not at first place.
         Usually this is caused by shell initialization files. Search for PATH=... entries.
         You can also re-add RVM to your profile by running: rvm get stable --auto-dotfiles
         To fix it temporarily in this shell session run: rvm use ruby-2.2.3@myenergyxpert
         To ignore this error add rvm_silence_path_mismatch_check_flag=1 to your ~/.rvmrc file.
# I added this configuration mentioned above to ignore this error 

rvm_silence_path_mismatch_check_flag=1 to your ~/.rvmrc file.


# Install ruby 
$ rvm install 2.6.0 --with-openssl-dir=/usr/local/opt/openssl

The solution above I got from the following comment:
postmodern/ruby-install#194 (comment)

# Install gem
$ gem install bundler

I hope this can help.

@Piero512
Copy link

Piero512 commented Feb 9, 2019

OpenSSL support is bad on macOS since Apple decided to deprecate openSSL and make their own libraries, so this workaround of --with-openssl-dir should be default config for macOS, since what most people will do is just install homebrew openssl.

@pkuczynski
Copy link
Member

@marcandre could you please run rvm get branch /with-openssl-dir and try again? @kelvinmatheus and @Piero512 you could also maybe try the same?

@Piero512
Copy link

It seems to have successfully installed ruby without any args.
Terminal's Output.txt
I have brew installed, so openssl was installed on /usr/local/opt/openssl/lib .

@jdashton
Copy link

The /with-openssl-dir branch was not an instant success on my machine. See this gist for the results.

I have OpenSSL 1.0.2q installed via Homebrew, but openssl at the command-line still points to Apple's LibreSSL implementation.

$ brew info openssl
openssl: stable 1.0.2q (bottled) [keg-only]
SSL/TLS cryptography library
https://openssl.org/
/usr/local/Cellar/openssl/1.0.2q (1,794 files, 12.1MB)
  Poured from bottle on 2018-11-27 at 15:20:23
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/openssl.rb
==> Caveats
A CA file has been bootstrapped using certificates from the SystemRoots
keychain. To add additional certificates (e.g. the certificates added in
the System keychain), place .pem files in
  /usr/local/etc/openssl/certs

and run
  /usr/local/opt/openssl/bin/c_rehash

openssl is keg-only, which means it was not symlinked into /usr/local,
because Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries.

If you need to have openssl first in your PATH run:
  echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile

For compilers to find openssl you may need to set:
  export LDFLAGS="-L/usr/local/opt/openssl/lib"
  export CPPFLAGS="-I/usr/local/opt/openssl/include"

For pkg-config to find openssl you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/openssl/lib/pkgconfig"

==> Analytics
install: 458,032 (30 days), 1,562,903 (90 days), 6,119,644 (365 days)
install_on_request: 56,846 (30 days), 219,503 (90 days), 860,590 (365 days)
build_error: 0 (30 days)
$ which -a openssl
/usr/bin/openssl
$

The distracting thing is that the error log is still fussing about

You don't have write permissions for the /ruby-2.6.1@global directory.

as if the earlier part of the directory (which should be ~/.rvm/gems/ is somehow missing or being ignored.

There's nothing in the error log that directly references OpenSSL:

$ grep -i ssl .rvm/log/1550590613_ruby-2.6.1/rubygems.install.log
$

@marcandre
Copy link
Author

Still running in the same errors.

When installing:

ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /ruby-2.6.1@global directory.

Trying it out afterwards then generates the "Could not load OpenSSL." error on bundle.

Full logs

@marcandre
Copy link
Author

Anything I can do to help, or should I reinstall rvm?

@jdashton
Copy link

jdashton commented Mar 5, 2019

I have to wonder if this is actually a problem with the commit to support RubyGems 3.0.2 in #4572 , maybe bbf398c

@marcandre
Copy link
Author

I uninstalled rvm completely and reinstalled it.

Still getting the dreaded "Could not load OpenSSL." error message after installing 2.6.2. 😭

@marcandre
Copy link
Author

I went nuclear, uninstalled rvm, brew, reinstalled Mojave, reinstalled brew & rvm and... it works 😺

@jdashton
Copy link

And, in contrast, I changed nothing, but both Ruby 2.5.4 and Ruby 2.6.2 installed without generating this error.

@elia
Copy link
Contributor

elia commented Apr 4, 2019

@marcandre @pkuczynski can we keep this open until there's a non-nuclear ☢️ solution? 😄

I bumped into this some months ago after brew decided it was time to clean up without me asking and removed libs required by readline. I just had the same problem right now after trying to install 2.4.5.

The bandaid-solution that worked for me was to run rvm gemset create global --default after the installation was completed with an error. But would love to see a proper one.

@marcandre marcandre reopened this Apr 4, 2019
@marcandre
Copy link
Author

Actually, my nuclear explosion fixed things only for 2.4, 2.5 and 2.6.

For older Rubies, I had to reinstall with a with-openssl-dir option like:

rvm reinstall 2.3 --with-openssl-dir=`brew --prefix openssl`

This worked well for ruby 2.2 and 2.3.

For Ruby 1.9 & 2.1, I get an error on reinstall with the with-openssl-dir option:

Making gemset ruby-2.1.10 pristine.............................................|
'command gem pristine --extensions  --version ' failed, you need to fix this gems manually.
.
Error running '__rvm_with ruby-2.1.10 gemset_pristine',
please read /Users/mal/.rvm/log/1554447187_ruby-2.1.10/gemset.pristine-ruby-2.1.10.log
Making gemset ruby-2.1.10@global pristine.......................................

Full log

This was fixed with:

rvm gemset create global --default

For Ruby 1.8.7, the rvm gemset create command itself fails because gem install can't find openssl.

@pchaganti
Copy link

👍

@pkuczynski pkuczynski modified the milestones: rvm-1.29.8, rvm-1.29.9 May 8, 2019
@pkuczynski pkuczynski removed this from the rvm-1.29.9 milestone Jul 10, 2019
@pkuczynski pkuczynski added this to the rvm-1.29.10 milestone Jul 10, 2019
@Furqanameen
Copy link

Folks,
I succeeded by doing this:
apt purge libssl-dev && apt install libssl1.0-dev...
After that the 'rvm install 2.3.5' works fine
Obs.: I tried before doing the same installation in a ubuntu 18.04 and the command 'rvm install 2.3.5' works fine too!
Is not the Tara version the same as ububtu 18.04? I'm afraid there will be other differences......

@galtzo
Copy link

galtzo commented Jul 10, 2019

(Crossposting my comment because many people in this thread have this issue, yet the thread hasn't addressed it at all)

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

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 #4607

@leonardofaria
Copy link

For the record:

I was trying to install 2.6.3 in Mojave (10.14.5) and got the following error:

Exception `LoadError' at /Users/leonardo/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/rubygems.rb:1375 - cannot load such file -- rubygems/defaults/operating_system
Exception `LoadError' at /Users/leonardo/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/rubygems.rb:1384 - cannot load such file -- rubygems/defaults/ruby
Exception `Gem::MissingSpecError' at /Users/leonardo/.rvm/rubies/ruby-2.6.3/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 /ruby-2.6.3@global directory.
Bundler 1.17.3 installed
RubyGems 3.0.4 installed
Regenerating binstubs

Solved this issue by running:

rvm gemset create global --default

@taranda
Copy link

taranda commented Nov 26, 2019

openssl 1.0.2 is no longer available via brew and openssl 1.1 does not seem to work with older versions of ruby (2.3.3) in my case. Do I just need to upgrade ruby or is there another work around?

@pkuczynski pkuczynski modified the milestones: rvm-1.29.10, rvm-1.29.11 Mar 25, 2020
@twobitfool
Copy link

This worked for me...

brew install rbenv/tap/openssl@1.0
rvm reinstall 2.2.9 --with-openssl-dir=`brew --prefix openssl@1.0`

@marcandre
Copy link
Author

@twobitfool 's trick worked for me, until I switched of machine, and install of old versions now fails.

I'm sorry to report that I've switched to rbenv. I had no trouble installing even 1.9.3.
I hope that rvm considers to use the same default strategy for openssl:
"ruby-build installs a non-Homebrew OpenSSL for each Ruby version installed and these are never upgraded."

@pkuczynski pkuczynski modified the milestones: rvm-1.29.11, rvm-1.29.12 Dec 29, 2020
@pkuczynski pkuczynski modified the milestones: rvm-1.29.12, rvm-1.29.13 Jan 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests