Mac安装rvm管理Ruby版本

安装gnupg

brew install gnupg
如果提示Error: The brew link step did not complete successfully, 那么根据提示一般可以修复:

The formula built, but is not symlinked into /usr/local
Could not symlink lib/libusb-1.0.0.dylib
Target /usr/local/lib/libusb-1.0.0.dylib
already exists. You may want to remove it:
  rm '/usr/local/lib/libusb-1.0.0.dylib'
  To force the link and overwrite all conflicting files:
  brew link --overwrite libusb

根据以上提示,可以运行brew link --overwrite libusb修复。
安装完毕,检查版本:

gpg --version

应该会出现类似如下信息:

gpg (GnuPG) 2.2.19
libgcrypt 1.8.5
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Home: /Users/simonliu/.gnupg
支持的算法:
公钥: RSA, ELG, DSA, ECDH, ECDSA, EDDSA
密文: IDEA, 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH,
    CAMELLIA128, CAMELLIA192, CAMELLIA256
散列: SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224
压缩:  不压缩, ZIP, ZLIB, BZIP2
安装GPG key
gpg --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
安装rvm

官方安装命令

curl -L get.rvm.io | bash -s stable

但是你可能会遇如下错误:

  • 错误1:(因为被墙)
curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused
  • 错误2:(你为了绕过第一个错误配置了代理)
curl: (35) LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to raw.githubusercontent.com:44

所以,直接访问get.rvm.io,将页面另存为rvm-installer.sh,给它权限并运行:

chomd +x ./rvm-installer.sh
./rvm-installer.sh
修改用户profile

比如修改./bashrc 或者 ./zshrc(如果你用zsh),添加一行

[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
rvm常用命令
  • 查看当前的ruby版本
rvm list

=*为当前的版本

  • 查看可安装的ruby版本
rvm list known
  • 安装想要的ruby版本
rvm install <version>
  • 切换ruby默认版本
rvm use ruby-2.7.0 --default

Note:

  1. use后面放rvm list安装的版本,可以直接放2.7.0,也可以放rvm list出来的全名
  2. –default设置默认版本,如果不加这个字段,则只是在当前控制台临时设置版本
  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值