在macOS上升级Global Ruby版本 [英] Upgrading Global Ruby Version on macOS

查看:117
本文介绍了在macOS上升级Global Ruby版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将计算机上的Ruby更新到版本2.7.0,因为这是最新的稳定版本.

I am trying to update Ruby on my computer to version 2.7.0 as that is the latest stable version.

运行macOS Catalina版本10.15.3

Running macOS Catalina Version 10.15.3

已尝试过此StackOverflow 帖子中的前两个解决方案.

Have tried the top two solutions from this StackOverflow post.

1.仅使用brew

brew upgrade ruby

仅确认"ruby​​ 2.6.5已安装"

just confirms that "ruby 2.6.5 already installed"

2.使用rbenv

rbenv install 2.7.0

rbenv global 2.7.0

安装后,我得到确认已安装ruby 2.7.0,但是当我关闭终端并检查版本时,2.6.5仍是当前版本.

After installation I get confirmation that ruby 2.7.0 is installed, but when I close terminal, and check version, 2.6.5 is still the current version.

最初,当我尝试此操作时,出现错误BUILD FAILED (OS X 10.15.3 using ruby-build 20200115).根据此github问题中的建议,我发现未安装Xcode(已安装Xcode ,但在最近几个月中将其删除).我重新安装了它,但仍然遇到同样的问题.

Initially when I tried this, I got an error BUILD FAILED (OS X 10.15.3 using ruby-build 20200115). Based on advise in this github issue I found that Xcode was not installed (it was installed, but something removed it in the last few months). I re-installed it, but still got the same issue.

3.还尝试了基于

3. Also tried RVM based on answer 3 from this post.

rvm upgrade 2.7.0

但是如果我想使用ruby-2.6.3,系统会提示我 我确实是偶然地答应了.所以现在我回到2.6.3

But I am prompted if I want to use ruby-2.6.3 I did said yes by accident. So now I am back down to 2.6.3

我需要做更多的事情来更改Ruby的全局环境设置吗?似乎rbenv global 2.7.0会做到这一点.

Do I need to do something more to change the global environment settings for Ruby? It seemed that rbenv global 2.7.0 would do this.

推荐答案

根据 anothermh 的建议,卸载了rbenv和brew版本的Ruby

As per advice from anothermh, uninstalled rbenv and brew versions of Ruby

卸载

brew uninstall ruby用于删除Brew版本

brew uninstall ruby for removing brew version

在[此SO]文章上使用接受的答案 1

Use accepted answer on [this SO] article1

通过RVM安装Ruby

rvm install (ruby version)

rvm --default use (ruby version)

可以使用rvm list查看可用的红宝石版本.

can use rvm list to see available ruby versions.

这篇关于在macOS上升级Global Ruby版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆