gpt4 book ai didi

ruby - 强制 macos 系统降级 ruby​​ 系统

转载 作者:行者123 更新时间:2023-12-03 23:34:41 25 4
gpt4 key购买 nike

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

我以 root 身份和非 root 身份尝试过的命令:

  • sudo brew install ruby@2.2.2brew install ruby@2.2.2导致错误
  • sudo gem update --system 2.2.2gem update --system 2.2.2导致程序自行中止

  • 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 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$

    我将如何从这里前进?

    最佳答案

    请勿尝试在 macOS 上修改、降级、升级、删除或使用 Ruby 的内置版本。相反,使用 Ruby 版本管理器来安装您需要的特定版本的 Ruby:

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

  • 然后重试您的操作。
    有关系统 Ruby 的更多信息,请访问 https://dontusesystemruby.com/ .

    关于ruby - 强制 macos 系统降级 ruby​​ 系统,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61375869/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com