M1-homebrew问题

1,291 阅读1分钟

homebrew 已经安装好了 在安装其他软件遇到问题

更新homebrew

brew update
// 查看版本
brew -v

安装carthage 错误

brew install carthage. 

报错

Warning: No remote 'origin' in /opt/homebrew/Homebrew/Library/Taps/homebrew/homebrew-cask, skipping update!

Warning: No remote 'origin' in /opt/homebrew/Homebrew/Library/Taps/homebrew/homebrew-core, skipping update!

Error: Cannot install under Rosetta 2 in ARM default prefix (/opt/homebrew)!

To rerun under ARM use:

    arch -arm64 brew install ...

To install under x86_64, install Homebrew into /usr/local.

image.png

采取新方式安装

arch -arm64 brew install carthage

遇到新问题

fatal: not in a git directory

Error: Command failed with exit 128: git

fatal: not in a git directory
Error: Command failed with exit 128: git

解决方案

brew -v
wangpanpan@wangpanpandeMacBook-Pro ~ % brew -v

Homebrew 3.5.4

fatal: unsafe repository ('/opt/homebrew/Homebrew/Library/Taps/homebrew/homebrew-core' is owned by someone else)

To add an exception for this directory, call:

\


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

Homebrew/homebrew-core (no Git repository)

fatal: unsafe repository ('/opt/homebrew/Homebrew/Library/Taps/homebrew/homebrew-cask' is owned by someone else)

To add an exception for this directory, call:

\


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

Homebrew/homebrew-cask (no Git repository)

执行命令

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

image.png

继续安装

arch -arm64 brew install carthage
carthage version

image.png