macOS 安装brew,以及重启终端指令无效解决办法-效率工具论坛-资源-SpringForAll社区

macOS 安装brew,以及重启终端指令无效解决办法

安装 

/usr/bin/ruby -e "$(curl -fsSL https://cdn.jsdelivr.net/gh/ineo6/homebrew-install/install)"

可能遇到的问题

执行install报错

问题现象:

fatal: not in a git directory

Error: Command failed with exit 128: git

解决办法:

办法一:

执行 unset HOMEBREW_BOTTLE_DOMAIN

办法二:

git config --global --add safe.directory /opt/homebrew/Library/Taps/homebrew/homebrew-core
git config --global --add safe.directory /opt/homebrew/Library/Taps/homebrew/homebrew-cask

重启终端brew不能用

问题现象:

brew: command not found

解决办法:

按以下步骤执行:

  1.  编辑 bash_profile
    1. vim  ~/.bash_profile
    2. 如果是intel芯片: 添加一行:export PATH=/usr/local/bin:$PATH
      如果是苹果芯片(M1,M2): 添加一行: export PATH=/opt/homebrew/bin:$PATH
    3. 如图:image
  2. 如果终端用的是 zsh

    1.  vim ~/.zshrc
    2.  在最后加入一行:source ~/.bash_profile
    3. 如图:
      image

 

请登录后发表评论