Mac M1 homebrew安装ruby后没有效果

看到输出下面的结果,就基本成功了,但是还差设置默认

By default, binaries installed by gem will be placed into:

  /opt/homebrew/lib/ruby/gems/3.1.0/bin

You may want to add this to your PATH.

ruby is keg-only, which means it was not symlinked into /opt/homebrew,

because macOS already provides this software and installing another version in

parallel can cause all kinds of trouble.

If you need to have ruby first in your PATH, run:

  echo 'export PATH="/opt/homebrew/opt/ruby/bin:$PATH"' >> ~/.zshrc

For compilers to find ruby you may need to set:

  export LDFLAGS="-L/opt/homebrew/opt/ruby/lib"

  export CPPFLAGS="-I/opt/homebrew/opt/ruby/include"

中间有提示

echo 'export PATH="/opt/homebrew/opt/ruby/bin:$PATH"' >> ~/.zshrc

终端中执行这段命令就好了。。

设置完还是不行,这是还差一步,这一步很多人没说,导致我也郁闷了一把,

一般是重启终端就好了

有时会遇到重启终端时——.zshrc报错not found……

这是你在/你的用户名/.zshrc  这个文件下,保存了错误的命令,用文本编辑打开这个文件,删除报错命令就行

没找到.zshrc文件,是你隐藏了文件,使用cmd + shift + .   快捷键显示隐藏文件

你可能感兴趣的:(Mac M1 homebrew安装ruby后没有效果)