заставить систему macos понижать ruby систему - PullRequest
0 голосов
/ 23 апреля 2020

Мне нужно использовать Ruby 2.2.2, но мой macOS поставляется с 2.6.3.

Команды, которые я пробовал как root, а не как root:

  • sudo brew install ruby@2.2.2 и brew install ruby@2.2.2 приводит к ошибке
  • sudo gem update --system 2.2.2 и gem update --system 2.2.2 приводит к тому, что программа сама себя прерывает

rvm не установлен.

Как мне установить Ruby 2.2.2?

edit:

, следуя приведенным ниже советам

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 openssl@1.1)"

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$ 

как мне двигаться дальше?

1 Ответ

2 голосов
/ 23 апреля 2020

Не пытайтесь изменять, понижать версию, обновлять, удалять или использовать встроенную версию Ruby в macOS. Вместо этого используйте менеджер версий Ruby для установки указанной c версии Ruby, которая вам требуется:

  • Установите RVM с \curl -sSL https://get.rvm.io | bash -s stable
  • Перезапустите оболочку
  • Установите Ruby с rvm install 2.2.2
  • Убедитесь, что вы используете правильную версию Ruby с ruby -v

Затем повторите операцию.

...