升级macOS系统到13之后git报错

这篇具有很好参考价值的文章主要介绍了升级macOS系统到13之后git报错。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

环境

  • Apple M1 Pro
  • macOS Ventura 13.0.1

问题

今天升级macOS系统到13之后,打开iterm2报错:

Last login: Mon Nov 14 10:50:57 on ttys001
[oh-my-zsh] Can't update: not a git repository.

同时,git命令也报错:

➜  ~ git
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

解决办法

运行 brew install git 命令,报错如下:

➜  ~ brew install git
Warning: You are using macOS 13.
We do not provide support for this pre-release version.
You will encounter build failures with some formulae.
Please create pull requests instead of asking for help on Homebrew's GitHub,
Twitter or any other official channels. You are responsible for resolving
any issues you experience while you are running this
pre-release version.

Error: No developer tools installed.
Install the Command Line Tools:
  xcode-select --install

Error: 'git' must be installed and in your PATH!
Warning: You are using macOS 13.
We do not provide support for this pre-release version.
You will encounter build failures with some formulae.
Please create pull requests instead of asking for help on Homebrew's GitHub,
Twitter or any other official channels. You are responsible for resolving
any issues you experience while you are running this
pre-release version.

Error: No developer tools installed.
Install the Command Line Tools:
  xcode-select --install

于是,按照它所说的,运行 xcode-select --install 命令,大约几分钟就安装好了,然后再次运行 brew install git 命令:

➜  ~ brew install git
Warning: You are using macOS 13.
We do not provide support for this pre-release version.
You will encounter build failures with some formulae.
Please create pull requests instead of asking for help on Homebrew's GitHub,
Twitter or any other official channels. You are responsible for resolving
any issues you experience while you are running this
pre-release version.

==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/gettext-0.21.arm64_monterey.bottle.tar.gz
curl: (22) The requested URL returned error: 404

Warning: Bottle missing, falling back to the default domain...
==> Downloading https://ghcr.io/v2/homebrew/core/gettext/manifests/0.21
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/gettext/blobs/sha256:6e2c829031949c0cbd758d0701ed62c191387736e76a98a046c0619907632225
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:6e2c829031949c0cbd758d0701ed62c191387736e76a98a046c0619907632225?se=2022-11-14T07%3A00%3A00Z&sig=b2ra5wi8LEu1tZ%2F3F%2BZa00rWc1%2BRUwtQgFZYYutKAoI%3D&sp=r&spr=https&sr=b&sv=2019-12-12
######################################################################## 100.0%
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/pcre2-10.40.arm64_monterey.bottle.tar.gz
######################################################################## 100.0%
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/git-2.36.1.arm64_monterey.bottle.tar.gz
curl: (22) The requested URL returned error: 404

Warning: Bottle missing, falling back to the default domain...
==> Downloading https://ghcr.io/v2/homebrew/core/git/manifests/2.36.1
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/git/blobs/sha256:5941a1eb703ac9814c2f8ae7c78ff31630aed04ad90a6a3073e45f4748f96e25
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:5941a1eb703ac9814c2f8ae7c78ff31630aed04ad90a6a3073e45f4748f96e25?se=2022-11-14T07%3A05%3A00Z&sig=vVetpAxWtdHFczH%2BSbS4OLY2B9f3wZN%2FkZR%2B9F%2BmKHM%3D&sp=r&spr=https&sr=b&sv=2019-12-12
######################################################################## 100.0%
==> Installing dependencies for git: gettext and pcre2
==> Installing git dependency: gettext
==> Pouring gettext-0.21.arm64_monterey.bottle.tar.gz
Error: No such file or directory @ rb_sysopen - /Users/dingkai/Library/Caches/Homebrew/downloads/fa30ad7b9d986e7383fd1dd0ea15940ed75d9da14cfe3ded90a80002ed0d253a--gettext-0.21.arm64_monterey.bottle.tar.gz

虽然最后报了个错,但是git已经装上了:文章来源地址https://www.toymoban.com/news/detail-602159.html

➜  ~ git -v
git version 2.37.1 (Apple Git-137.1)

到了这里,关于升级macOS系统到13之后git报错的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包