# 获取当前系统使用的 ruby 版本。 $ ruby -v ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin20] # 检测是否安装 RVM,RVM 是安装和管理 ruby 的工具。 $ rvm zsh: command not found: rvm # Install RVM stable with ruby: # 命令来源 [RVM: Ruby Version Manager - Installing RVM](https://rvm.io/rvm/install#1-download-and-run-the-rvm-installation-script)。 $ \curl -sSL https://get.rvm.io | bash -s stable --ruby curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused # 失败提示 port 443: Connection refused,有如下解决办法: # 1. 科学上网。 # 2. 设置DNS为114.114.114.114或者8.8.8.8。 # 3. 替代镜像,比如中科大镜像$(curl -fsSL https://cdn.jsdelivr.net/gh/ineo6/homebrew-install/install.sh)。 # 4. 在 https://www.ipaddress.com/ 查询 http://raw.githubusercontent.com 的真实IP,然后修改 hosts。 # 这里我是使用科学上网,先验证终端能否访问 Google。 $ curl google.com ^C # 发现不行,然后执行终端代理命令,我这条命令来自 ClashX。 $ export https_proxy=http://127.0.0.1:7890 http_proxy=http://127.0.0.1:7890 all_proxy=socks5://127.0.0.1:7890 # 再次验证终端能否访问 Google。 $ curl google.com <HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8"> <TITLE>301 Moved</TITLE></HEAD><BODY> <H1>301 Moved</H1> The document has moved <A HREF="http://www.google.com/">here</A>. </BODY></HTML> # 执行安装 RVM stable 的命令。 $ \curl -sSL https://get.rvm.io | bash -s stable --ruby curl: (22) The requested URL returned error: 403 WARN: ...the preceeding error with code 22 occurred while fetching https://api.github.com/repos/rvm/rvm/tags Downloading https://github.com/rvm/rvm/archive/1.29.12.tar.gz Downloading https://github.com/rvm/rvm/releases/download/1.29.12/1.29.12.tar.gz.asc Found PGP signature at: 'https://github.com/rvm/rvm/releases/download/1.29.12/1.29.12.tar.gz.asc', but no GPG software exists to validate it, skipping. Installing RVM to /Users/ganzhixiong/.rvm/ Adding rvm PATH line to /Users/ganzhixiong/.profile /Users/ganzhixiong/.mkshrc /Users/ganzhixiong/.bashrc /Users/ganzhixiong/.zshrc. Adding rvm loading line to /Users/ganzhixiong/.profile /Users/ganzhixiong/.bash_profile /Users/ganzhixiong/.zlogin. Installation of RVM in /Users/ganzhixiong/.rvm/ is almost complete:
* To start using RVM you need to run `source /Users/ganzhixiong/.rvm/scripts/rvm` in all your open shell windows, in rare cases you need to reopen all shell windows. Thanks for installing RVM 🙏 Please consider donating to our open collective to help us maintain RVM.
👉 Donate: https://opencollective.com/rvm/donate
Ruby enVironment Manager 1.29.12 (latest) (c) 2009-2020 Michal Papis, Piotr Kuczynski, Wayne E. Seguin
Searching for binary rubies, this might take some time. Found remote file https://rvm_io.global.ssl.fastly.net/binaries/osx/11.6/x86_64/ruby-3.0.0.tar.bz2 Checking requirements for osx. About to install Homebrew in the default location `/usr/local`.
It is possible to select a custom location, however it is not recommended and some things might not work. You should do it only if you do not have write rights to `/usr/local`.
Press ENTER to install Homebrew in the default location `/usr/local` or type a custom path (needs to be writable for the current user) : Requirements installation failed with status: 1. # Requirements installation failed with status: 1. 安装失败。 # 然后又在 [RVM: Ruby Version Manager - Installing RVM](https://rvm.io/rvm/install#1-download-and-run-the-rvm-installation-script) 找到如下命令, # Installing the stable release version:(该命令只是少了最后的 --ruby,就是不使用 ruby 安装 RVM。) $ \curl -sSL https://get.rvm.io | bash -s stable
Downloading https://github.com/rvm/rvm/archive/1.29.12.tar.gz Downloading https://github.com/rvm/rvm/releases/download/1.29.12/1.29.12.tar.gz.asc Found PGP signature at: 'https://github.com/rvm/rvm/releases/download/1.29.12/1.29.12.tar.gz.asc', but no GPG software exists to validate it, skipping. Upgrading the RVM installation in /Users/ganzhixiong/.rvm/ RVM PATH line found in /Users/ganzhixiong/.mkshrc /Users/ganzhixiong/.profile /Users/ganzhixiong/.bashrc /Users/ganzhixiong/.zshrc. RVM sourcing line found in /Users/ganzhixiong/.profile /Users/ganzhixiong/.bash_profile /Users/ganzhixiong/.zlogin. Upgrade of RVM in /Users/ganzhixiong/.rvm/ is complete.
Thanks for installing RVM 🙏 Please consider donating to our open collective to help us maintain RVM.
👉 Donate: https://opencollective.com/rvm/donate
# 看提示就是安装 RVM 成功了。 $ rvm -v zsh: command not found: rvm $ source ~/.bash_profile $ rvm -v rvm 1.29.12 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io]
用 RVM 安装 Ruby
Error running ‘__rvm_make -j10’
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
$ rvm install 3.0.0
ruby-3.0.0 - #removing src/ruby-3.0.0 - please wait Searching for binary rubies, this might take some time. No binary rubies available for: osx/12.6/arm64/ruby-3.0.0. Continuing with compilation. Please read'rvm help mount' to get more information on binary rubies. Checking requirements for osx. Certificates bundle '/opt/homebrew/etc/openssl@1.1/cert.pem' is already up to date. Requirements installation successful. Installing Ruby from source to: /Users/gan/.rvm/rubies/ruby-3.0.0, this may take a while depending on your cpu(s)... ruby-3.0.0 - #downloading ruby-3.0.0, this may take a while depending on your connection... ruby-3.0.0 - #extracting ruby-3.0.0 to /Users/gan/.rvm/src/ruby-3.0.0 - please wait ruby-3.0.0 - #configuring - please wait ruby-3.0.0 - #post-configuration - please wait ruby-3.0.0 - #compiling - please wait Error running '__rvm_make -j10', please read /Users/gan/.rvm/log/1691140731_ruby-3.0.0/make.log
There has been an error while running make. Halting the installation.