试图为同事设置一个新的macbook.不顺利.
首先我安装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
Run Code Online (Sandbox Code Playgroud)
然后我尝试用openssl安装ruby ...
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.
Run Code Online (Sandbox Code Playgroud)
顺便说一句,宝石文件说"来源https://rubygems.org "
想法?
小智 30
OP实际上救了我的一天!就我而言:
$ rvm pkg install openssl
$ rvm remove 2.4
$ rvm install 2.4 --with-openssl-dir=$HOME/.rvm/usr
$ gem install bundler
Run Code Online (Sandbox Code Playgroud)
nor*_*raj 18
它在ArchLinux wiki上有很好的描述:
Ruby 2.4 之前的版本需要 OpenSSL 1.0,但 RVM 将尝试使用 OpenSSL 1.1 构建它们。
所以你可以做(最简单的):
$ rvm pkg install openssl
$ rvm reinstall 2.3.5 --with-openssl-dir=$HOME/.rvm/usr
Run Code Online (Sandbox Code Playgroud)
您可以在ArchLinux wiki上查看更多解决方案。
fme*_*dez 15
试试这个:
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)]
Run Code Online (Sandbox Code Playgroud)
Chr*_*bbs 15
这是我如何在带有 Catalina 的 Mac 上安装 rvm 和 ruby 2.3。安装的 rvm 版本是 1.29.9。必须安装 OpenSSL 1.0.2(降级)。请注意 gpg 命令中的“ipv4”。
gpg --keyserver hkp://ipv4.pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
\curl -sSL https://get.rvm.io | bash -s stable
Run Code Online (Sandbox Code Playgroud)
在https://www.openssl.org/source/下载 openssl 1.0.2
tar -xzf openssl-1.0.2t.tar.gz
cd openssl-1.0.2t
./Configure darwin64-x86_64-cc --prefix=/usr/local/opt/openssl@1.0
make
make test
sudo make install
rvm install 2.3.3 --with-openssl-dir=/usr/local/opt/openssl@1.0
ruby -v
ruby -ropenssl -e 'puts OpenSSL::OPENSSL_VERSION'
>> OpenSSL 1.0.2t 10 Sep 2019
Run Code Online (Sandbox Code Playgroud)
小智 14
使用Homebrew在macOS Mojave(10.14.2)上安装Ruby 2.2。
brew install openssl
rvm install 2.2 --with-openssl-dir=/usr/local/opt/openssl
Run Code Online (Sandbox Code Playgroud)
不要使用rvm pkg
它的过时,使用rvm autolibs enabled
。
小智 6
在MacOS 10.12.2上通过brew安装openssl,将无法正常工作.要修复它,请运行:
export PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig:/usr/local/lib/pkgconfig
Run Code Online (Sandbox Code Playgroud)
然后通过rvm安装Ruby.
编辑:关于这个问题背后的原因更多的信息在这里.
对于那些在 Mac Mojave 上通过 RVM 使用 openssl 1.1 和 Ruby 2.3 的人,您可以尝试以下命令。问题是 Ruby 2.3 与 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
Run Code Online (Sandbox Code Playgroud)
对于 MacOS 上的 rvm
首先,检查您是否安装了 openssl。你应该看到这样的东西:
$ brew --prefix openssl
/usr/local/opt/openssl@1.1
Run Code Online (Sandbox Code Playgroud)
如果未安装 openssl,请安装。
$ brew install openssl
$ brew unlink openssl
$ brew link --force openssl
Run Code Online (Sandbox Code Playgroud)
如果您安装了多个 openssl,请考虑删除除一个之外的所有 openssl,以使您的生活更轻松。
$ brew cleanup openssl
$ brew list --versions openssl
$ brew uninstall <unwanted-openssl-version-here>
Run Code Online (Sandbox Code Playgroud)
现在重新安装 ruby 版本,指定所需的 openssl 路径。
$ rvm reinstall <your-version-here> --with-openssl-dir=`brew --prefix openssl`
Run Code Online (Sandbox Code Playgroud)
最后,验证您的 ruby 是否使用与其链接的相同 openssl 进行编译。如果您两次看到相同的版本,那么您应该已准备就绪。
$ 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
Run Code Online (Sandbox Code Playgroud)
如果稍后安装其他版本的 ruby,则需要传递相同的--with-openssl-dir
参数。或者,我相信您可以在 bash 配置文件中设置以下变量。
export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$(brew --prefix openssl)/lib/pkgconfig"
export LIBRARY_PATH="$LIBRARY_PATH:$(brew --prefix openssl)/lib"
Run Code Online (Sandbox Code Playgroud)
如果上述方法不起作用,请从 bash 配置文件中删除这些行,然后仅使用--with-openssl-dir
上面的参数。
参考: https: //github.com/rvm/rvm/issues/4562 参考: https: //bugs.ruby-lang.org/issues/12630
对于旧版本的 ruby 2.2.10
,MacOS High Sierra 10.13.6
唯一对我有用的是:
brew switch openssl 1.0.2s
Run Code Online (Sandbox Code Playgroud)
--with-openssl-dir
rvm reinstall 2.2.10 --with-openssl-dir=/usr/local/Cellar/openssl/1.0.2s
Run Code Online (Sandbox Code Playgroud)
Mac 上使用 homebrew 的任何人都可以使用这个对我有用的命令。
rvm install 2.7.7 --with-openssl-dir=$(brew --prefix openssl)/lib
小智 5
这是对我有用的:
brew install rbenv/tap/openssl@1.0
rvm reinstall 1.9.3-p551 --with-openssl-dir='/usr/local/opt/openssl@1.0'
gem update --system
Run Code Online (Sandbox Code Playgroud)
干杯!
归档时间: |
|
查看次数: |
17765 次 |
最近记录: |