M1 Mac安装原生 Homebrew

首先创建安装目录

sudo mkdir -p /opt/homebrew

将目录属主修改为当前用户,方便以后用当前用户直接brew install软件

sudo chown -R $(whoami) /opt/homebrew

进入 /opt 文件夹

cd /opt

直接下载homebrew tar包并解压

curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C homebrew

  

将路径增加到PATH环境变量中

如果使用的是zsh则直接修改~/.zshrc,如果使用的是bash,则修改~/.bash_profile

export BREW_HOME=/opt/homebrew
export PATH=$PATH:$BREW_HOME/bin

  

新开一个Terminal窗口或者在当前窗口让环境变量生效

source ~/.zshrc

  

现在可以安装软件了,注意要使用-s选项,表示编译源码安装

brew install -s wget

  

 

相关文章:

  • 2021-05-02
  • 2022-02-24
  • 2021-06-10
  • 2022-02-12
  • 2021-05-25
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-11-23
  • 2021-04-18
  • 2021-05-14
  • 2021-06-25
相关资源
相似解决方案