强行将macos系统降级为ruby系统。

问题描述 投票:0回答:1

我需要使用Ruby 2.2.2,但我的macOS是2.6.3。

我以root和非root两种身份尝试过的命令。

rvm没有安装。

如何安装Ruby 2.2.2?

编辑。

按照下面的建议

install RVM with \curl -sSL https://get.rvm.io | bash -s stable
Restart your shell
Install Ruby with rvm install 2.2.2
Verify you are using the correct version of Ruby with ruby -v

然后我得到了这个错误。

CL-CJAKOB-XMD6R:~ cjakob$ rvm install 2.2.2
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.15/x86_64/ruby-2.2.2.
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......
Installing required packages: automake, libtool, coreutils, libyaml, libksba, zlib, openssl..............
==> Upgrading 2 outdated packages:
pkg-config 0.29.2 -> 0.29.2_3
readline 8.0.1 -> 8.0.4
==> Upgrading readline 8.0.1 -> 8.0.4 
==> Downloading https://homebrew.bintray.com/bottles/readline-8.0.4.catalina.bot
==> Downloading from https://akamai.bintray.com/6a/6ae1c8e7c783f32bd22c6085caa4d
######################################################################## 100.0%
==> Pouring readline-8.0.4.catalina.bottle.tar.gz
==> Caveats
readline is keg-only, which means it was not symlinked into /usr/local,
because macOS provides BSD libedit.

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

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

==> Summary
🍺  /usr/local/Cellar/readline/8.0.4: 48 files, 1.5MB
Removing: /usr/local/Cellar/readline/8.0.1... (48 files, 1.5MB)
==> Upgrading pkg-config 0.29.2 -> 0.29.2_3 
==> Downloading https://homebrew.bintray.com/bottles/pkg-config-0.29.2_3.catalin
==> Downloading from https://akamai.bintray.com/80/80f141e695f73bd058fd82e9f539d
######################################################################## 100.0%
==> Pouring pkg-config-0.29.2_3.catalina.bottle.tar.gz
🍺  /usr/local/Cellar/pkg-config/0.29.2_3: 11 files, 623.7KB
Removing: /usr/local/Cellar/pkg-config/0.29.2... (11 files, 623KB)
==> Checking for dependents of upgraded formulae...
==> Upgrading 2 dependents:
ruby-build 20200115 -> 20200401, ruby-build 20200115 -> 20200401
==> Upgrading ruby-build 20200115 -> 20200401 
==> Downloading https://github.com/rbenv/ruby-build/archive/v20200401.tar.gz
==> Downloading from https://codeload.github.com/rbenv/ruby-build/tar.gz/v202004
######################################################################## 100.0%
==> ./install.sh
==> Caveats
ruby-build installs a non-Homebrew OpenSSL for each Ruby version installed and these are never upgraded.

To link Rubies to Homebrew's OpenSSL 1.1 (which is upgraded) add the following
to your ~/.bash_profile:
  export RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix [email protected])"

Note: this may interfere with building old versions of Ruby (e.g <2.4) that use
OpenSSL <1.1.
==> Summary
🍺  /usr/local/Cellar/ruby-build/20200401: 495 files, 245.2KB, built in 4 seconds
Removing: /usr/local/Cellar/ruby-build/20200115... (470 files, 234.4KB)
==> Checking for dependents of upgraded formulae...
Error: No such file or directory - /usr/local/Cellar/ruby-build/20200115
Requirements installation failed with status: 1.
CL-CJAKOB-XMD6R:~ cjakob$ 

我该如何继续前进?

ruby macos version homebrew
1个回答
2
投票

不要试图修改、降级、升级、删除或使用macOS上内置的Ruby版本。相反,使用Ruby版本管理器来安装你所需要的Ruby的特定版本。

  • 安装RVM \curl -sSL https://get.rvm.io | bash -s stable
  • 重新启动你的shell
  • 用以下方法安装Ruby rvm install 2.2.2
  • 验证你使用的是正确的Ruby版本。ruby -v

然后重新尝试你的操作。

© www.soinside.com 2019 - 2024. All rights reserved.