欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

MAC下安装homebrew.(-bash: brew: command not found)

程序员文章站 2022-07-12 13:23:48
...

安装homebrew的过程真是艰辛,屡战屡败,下了不下四五次了。
每次都是环境变量的锅

安装

请直接参考大佬文章,这里就不详述了https://zhuanlan.zhihu.com/p/90508170?utm_source=com.tencent.tim&utm_medium=social&utm_oi=1117506435474448384
(一次不行可以重装多次,总会成功)

安装好后,如果出现这个waring,代表环境变量有问题

Warning: /usr/local/bin is not in your PATH.
==> Installation successful!

==> Homebrew has enabled anonymous aggregate formulae and cask analytics.
Read the analytics documentation (and how to opt-out) here:
  https://docs.brew.sh/Analytics

==> Homebrew is run entirely by unpaid volunteers. Please consider donating:
  https://github.com/Homebrew/brew#donations
==> Next steps:
- Run `brew help` to get started
- Further documentation: 
    https://docs.brew.sh

测试发现是这个:

brew update

-bash: brew: command not found

检查:环境变量

sudo vi ~/.bash_profile

//添加
export PATH=/usr/local/bin:$PATH
//保存后终端执行
source ~/.bash_profile
export PATH=/usr/local/bin:$PATH
//再次尝试
brew -v
或者
brew update
//能执行brew命令就成了

安装homebrew的艰辛之路终于结束了QTQ

相关标签: 那些事 mac