系统自动升级openssl导致的rails无法启动(ruby 2.3.1)

安装很多带依赖的软件都可以导致我原来的系统自动升级openssl,但由于我一个旧系统使用的ruby的版本时2.3.1,这个版本是只支持到openssl的1.0版本,为什么这么说,我先介绍如果通过rvm来重新安装openssl的旧版本

让rvm来找合适的openssl包

rvm pkg install openssl
Warning! PATH is not properly set up, /Users/ryanvan/.rvm/gems/ruby-2.3.1/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.3.1
         To ignore this error add rvm_silence_path_mismatch_check_flag=1 to your ~/.rvmrc file.
Warning, new version of rvm available '1.29.10', you are using older version '1.29.8'.
You can disable this warning with:    echo rvm_autoupdate_flag=0 >> ~/.rvmrc
You can enable  auto-update  with:    echo rvm_autoupdate_flag=2 >> ~/.rvmrc
 
Beware, 'rvm pkg ...' is deprecated, read about the new autolibs feature: 'rvm help autolibs'.
 
Checking requirements for osx.
Certificates bundle '/usr/local/etc/openssl@1.1/cert.pem' is already up to date.
Requirements installation successful.
Fetching openssl-1.0.1i.tar.gz to /Users/ryanvan/.rvm/archives
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 4318k  100 4318k    0     0  1067k      0  0:00:04  0:00:04 --:--:-- 1067k
Extracting openssl to /Users/ryanvan/.rvm/src/openssl-1.0.1i.....
Configuring openssl in /Users/ryanvan/.rvm/src/openssl-1.0.1i.......................
Compiling openssl in /Users/ryanvan/.rvm/src/openssl-1.0.1i...........................................................................................................................................................................................
Installing openssl to /Users/ryanvan/.rvm/usr.........................................................................................................................................................
 
Please note that it's required to reinstall all rubies:
 
    rvm reinstall all --force
 
Updating openssl certificates....

rvm reinstall 2.3.1 --with-openssl-dir=$HOME/.rvm/usr --force

安装后,可能会报错:

'command gem pristine --extensions mysql2 --version 0.4.10 mysql2 --version 0.4.5 mysql2 --version 0.4.4 puma --version 3.6.0' failed, you need to fix these gems manually.
.
Error running '__rvm_with ruby-2.3.1 gemset_pristine',
please read /Users/ryanvan/.rvm/log/1595927055_ruby-2.3.1/gemset.pristine-ruby-2.3.1.log

这是mysql的问题,例如:

gem install mysql2 -v '0.4.4'
Building native extensions. This could take a while...
ERROR:  Error installing mysql2:
        ERROR: Failed to build gem native extension.
 

试试:

brew services start mysql@5.7
brew link mysql@5.7 --force`

然后执行bundle install done

自己重装openssl 1.0版本

$ git clone https://github.com/Homebrew/homebrew-core.git
$ cd homebrew-core
$ git checkout 75b57384 Formula/openssl.rb
$ brew install Formula/openssl.rb

默认安装在:/usr/local/Cellar/openssl/1.0.2m/lib
在bundle的过程如果报错,可以查看信息,我的系统需要在/usr/local/opt/openssl/lib里增加一些链接:

libcrypto.1.0.0.dylib -> /usr/local/Cellar/openssl/1.0.2m/lib/libcrypto.1.0.0.dylib
libssl.1.0.0.dylib -> /usr/local/Cellar/openssl/1.0.2m/lib/libssl.1.0.0.dylib
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值