为 Appacademy 的新 Macbook Air (M1) 安装正确的 Ruby / rbenz

时间:2021-06-17 23:46:13

标签: ruby-on-rails ruby terminal

我正在开始 appacademy 公开课程,并试图按照他们想要的方式设置 Ruby。我已按照他们的说明安装 rbenz。我安装了 rbenz 2.7.2,因为我听说它与新的 M1 芯片兼容。一切似乎都奏效了。但是,当我检查 ruby​​ 版本 (ruby -v) 时,我遇到了一个重复错误:

/Users/raylang/.rbenv/shims/ruby: line 3: =: command not found
/Users/raylang/.rbenv/shims/ruby: line 3: =: command not found
/Users/raylang/.rbenv/shims/ruby: line 3: =: command not found```



It's weird because it tells me that I have installed it already:

```Installed openssl-1.1.1k to /Users/raylang/.rbenv/versions/2.7.2

Downloading ruby-2.7.2.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.7/ruby-2.7.2.tar.bz2
Installing ruby-2.7.2...
ruby-build: using readline from homebrew
Installed ruby-2.7.2 to /Users/raylang/.rbenv/versions/2.7.2```


Any ideas anyone?

1 个答案:

答案 0 :(得分:0)

我猜你用自制软件安装了rbenv

您是否更新了 .bashrc 或 .zshrc?

如果还没有,请添加以下内容

# rbenv
export PATH="~/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
export PATH="~/.rbenv/shims:/usr/local/bin:$PATH"

然后重启终端。

之后设置全局 ruby​​ 版本。

rbenv global x.x.x # 2.7.2 etc.

然后你可以使用ruby -v

了解更多信息:https://github.com/rbenv/rbenv#installation