web-dev-qa-db-fra.com

problèmes avec RVM et OpenSSL

Essayer de configurer un nouveau macbook pour un collègue. Ne va pas bien.

J'installe d'abord OpenSSL:

Heathers-MacBook-Pro:~ heather$ rvm pkg install openssl
Fetching openssl-1.0.1c.tar.gz to /Users/heather/.rvm/archives
######################################################################## 100.0%
Extracting openssl to /Users/heather/.rvm/src/openssl-1.0.1c
Configuring openssl in /Users/heather/.rvm/src/openssl-1.0.1c.
Compiling openssl in /Users/heather/.rvm/src/openssl-1.0.1c.
Installing openssl to /Users/heather/.rvm/usr

Please note that it's required to reinstall all rubies:

    rvm reinstall all --force

Updating openssl certificates

Ensuite, j'essaie d'installer Ruby avec openssl ...

Heathers-MacBook-Pro:website heather$ rvm install 1.9.3 --with-openssl-dir=$HOME/.rvm/usr
Fetching yaml-0.1.4.tar.gz to /Users/heather/.rvm/archives
Extracting yaml to /Users/heather/.rvm/src/yaml-0.1.4
Configuring yaml in /Users/heather/.rvm/src/yaml-0.1.4.
Compiling yaml in /Users/heather/.rvm/src/yaml-0.1.4.
Installing yaml to /Users/heather/.rvm/usr
Installing Ruby from source to: /Users/heather/.rvm/rubies/Ruby-1.9.3-p392, this may take a while depending on your cpu(s)...
Ruby-1.9.3-p392 - #downloading Ruby-1.9.3-p392, this may take a while depending on your connection...
Ruby-1.9.3-p392 - #extracting Ruby-1.9.3-p392 to /Users/heather/.rvm/src/Ruby-1.9.3-p392
Ruby-1.9.3-p392 - #extracted to /Users/heather/.rvm/src/Ruby-1.9.3-p392
Ruby-1.9.3-p392 - #configuring
Ruby-1.9.3-p392 - #compiling
Ruby-1.9.3-p392 - #installing 
Removing old Rubygems files...
Installing rubygems-1.8.25 for Ruby-1.9.3-p392 ...
Installation of rubygems completed successfully.
Saving wrappers to '/Users/heather/.rvm/bin'.
Ruby-1.9.3-p392 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
Ruby-1.9.3-p392 - #importing default gemsets, this may take time ...
Install of Ruby-1.9.3-p392 - #complete 

Heathers-MacBook-Pro:website heather$ bundle update
Could not load OpenSSL.
You must recompile Ruby with OpenSSL support or change the sources in your Gemfile from 'https' to 'http'. Instructions for
compiling with OpenSSL using RVM are available at rvm.io/packages/openssl.

btw, le fichier gem dit "source https://rubygems.org "

des idées?

22
phil swenson

Essaye ça:

rvm get head
rvm pkg remove
rvm requirements run  # if brew gives you warnings about formulas to install, run "brew install" for each before moving on.

rvm reinstall [the version you need (i.e: 2.0.0)]
18
fmendez

OP m'a sauvé la journée! Dans mon cas:

$ rvm pkg install openssl
$ rvm remove 2.4
$ rvm install 2.4 --with-openssl-dir=$HOME/.rvm/usr
$ gem install bundler
46
phq

Installation de Ruby 2.2 sur macOS Mojave (10.14.2) avec Homebrew.

Installer Homebrew

brew install openssl
rvm install 2.2 --with-openssl-dir=/usr/local/opt/openssl

N'utilisez pas rvm pkg c'est obsolète , utilisez rvm autolibs enabled.

16
guapolo

Il est bien décrit sur ArchLinux wiki :

Les versions Ruby antérieures à 2.4 nécessitent OpenSSL 1.0 mais RVM essaiera de les construire avec OpenSSL 1.1.

Vous pouvez donc faire (le plus simple):

$ rvm pkg install openssl
$ rvm reinstall 2.3.5 --with-openssl-dir=$HOME/.rvm/usr

Vous pouvez voir plus de solutions sur ArchLinux wiki .

15
noraj

Voici comment j'ai installé rvm et Ruby 2.3 sur un mac avec Catalina. La version de rvm installée était 1.29.9. OpenSSL 1.0.2 (downgrade) devait être installé. Notez le "ipv4" dans la commande gpg.

gpg --keyserver hkp://ipv4.pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
\curl -sSL https://get.rvm.io | bash -s stable

Téléchargez openssl 1.0.2 sur https://www.openssl.org/source/

tar -xzf openssl-1.0.2t.tar.gz
cd openssl-1.0.2t
./Configure darwin64-x86_64-cc --prefix=/usr/local/opt/[email protected]
make
make test
Sudo make install

rvm install 2.3.3 --with-openssl-dir=/usr/local/opt/[email protected]
Ruby -v
Ruby -ropenssl -e 'puts OpenSSL::OPENSSL_VERSION'              
>> OpenSSL 1.0.2t  10 Sep 2019
10
Chris Hobbs

Sur MacOS 10.12.2, installer openssl via brew ne fonctionnera pas. Pour le corriger, exécutez:

export PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig:/usr/local/lib/pkgconfig

Et puis installez Ruby via rvm.

EDIT: Plus d'informations sur la raison du problème ici .

6
blazejmar

Pour ceux qui ont des problèmes avec openssl 1.1 et Ruby 2.3 via RVM sur Mac Mojave, vous pouvez essayer les commandes suivantes. Le problème est Ruby 2.3 n'est pas compatible avec openssl 1.1

rvm pkg install openssl
PKG_CONFIG_PATH=$HOME/.rvm/usr/lib/pkgconfig rvm reinstall 2.3.3 --with-openssl-dir=$HOME/.rvm/usr
5
zhongxiao37

Cela a donc fonctionné pour moi:

rvm pkg install openssl
rvm reinstall all --force

J'avais aussi rvm autolibs rvm_pkg pour le support readline.

3
Dorian

version openssl: 1.0.2k

Cela a fonctionné pour moi:

brew reinstall openssl
2
ruslan

Pour rvm sur MacOS

Tout d'abord, vérifiez et voyez si vous avez installé openssl. Vous devriez voir quelque chose comme ceci:

$ brew --prefix openssl
/usr/local/opt/[email protected]

Si openssl n'est pas installé, faites-le.

$ brew install openssl
$ brew unlink openssl
$ brew link --force openssl

Si vous avez plus d'un openssl installé, envisagez d'en supprimer tous sauf un pour vous faciliter la vie.

$ brew cleanup openssl
$ brew list --versions openssl
$ brew uninstall <unwanted-openssl-version-here>

Réinstallez maintenant la version Ruby, en spécifiant le chemin openssl souhaité.

$ rvm reinstall <your-version-here> --with-openssl-dir=`brew --prefix openssl`

Enfin, vérifiez que votre Ruby a été compilé avec le même openssl auquel il était lié. Si vous voyez deux fois la même version, vous devriez être prêt.

$ Ruby -ropenssl -e'puts OpenSSL::OPENSSL_VERSION, OpenSSL::OPENSSL_LIBRARY_VERSION'
OpenSSL 1.1.1d  10 Sep 2019
OpenSSL 1.1.1d  10 Sep 2019

Si plus tard vous installez d'autres versions de Ruby, vous devrez passer le même --with-openssl-dir argument. Alternativement, je pense que vous pouvez définir les variables suivantes dans votre profil bash.

export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$(brew --prefix openssl)/lib/pkgconfig"
export LIBRARY_PATH="$LIBRARY_PATH:$(brew --prefix openssl)/lib"

Si ce qui précède ne fonctionne pas, supprimez les lignes de votre profil bash et utilisez simplement le --with-openssl-dir argument comme ci-dessus.

Réf: https://github.com/rvm/rvm/issues/4562 Réf: https://bugs.Ruby-lang.org/issues/126

0
Ben Amos

Voici ce qui a fonctionné pour moi:

brew install rbenv/tap/[email protected]
rvm reinstall 1.9.3-p551 --with-openssl-dir='/usr/local/opt/[email protected]'
gem update --system

À votre santé!

0
Hernan