• 升级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.
    
    • 1
    • 2

    同时,git命令也报错:

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

    解决办法

    运行 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
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25

    于是,按照它所说的,运行 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
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33

    虽然最后报了个错,但是git已经装上了:

    ➜  ~ git -v
    git version 2.37.1 (Apple Git-137.1)
    
    • 1
    • 2
  • 相关阅读:
    计算圆的周长和面积——python
    SpringBoot 整和 Netty 并监听多端口
    linux下离线安装k8s集群1.19.4附带nfs存储
    lodash已死?radash库方法介绍及源码解析 —— 判断方法篇
    响应国家十四五规划,ABeam(德硕)科技赋能可靠股份数智化转型
    JavaScript 18 JavaScript 字符串
    【调制解调】FM 调频
    Cadence OrCAD Capture 原理图设计过程产生的文件总结与说明
    Open3D(C++) 网格变形
    【异常】com.alicp.jetcache.CacheException: refresh error
  • 原文地址:https://blog.csdn.net/duke_ding2/article/details/127847663