1、安装Homebrew
2、安装Git
命令:brew install git
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 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# mcj @ M1_Max in ~ [15:40:08] $ brew install git Warning: No remote 'origin' in /opt/homebrew/Library/Taps/homebrew/homebrew-services, skipping update! Running `brew update --auto-update`... ==> Homebrew collects anonymous analytics. Read the analytics documentation (and how to opt-out) here: https://docs.brew.sh/Analytics No analytics have been recorded yet (nor will be during this `brew` run). ==> Homebrew is run entirely by unpaid volunteers. Please consider donating: https://github.com/Homebrew/brew#donations Installing from the API is now the default behaviour! You can save space and time by running: brew untap homebrew/core brew untap homebrew/cask ==> Auto-updated Homebrew! Updated 2 taps (homebrew/core and homebrew/cask). ==> New Formulae deadfinder flowpipe icloudpd mtm openjph tfautomv ==> New Casks cleanupbuddy easydevo mumuplayer nrfutil You have 1 outdated formula installed. ==> Fetching dependencies for git: gettext ==> Fetching gettext ==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/gettext-0.22.4.arm6 ######################################################################### 100.0% ==> Fetching git ==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/git-2.43.0.arm64_ve ######################################################################### 100.0% ==> Installing dependencies for git: gettext ==> Installing git dependency: gettext ==> Pouring gettext-0.22.4.arm64_ventura.bottle.tar.gz 🍺 /opt/homebrew/Cellar/gettext/0.22.4: 2,042 files, 24.3MB ==> Installing git ==> Pouring git-2.43.0.arm64_ventura.bottle.tar.gz ==> Caveats The Tcl/Tk GUIs (e.g. gitk, git-gui) are now in the `git-gui` formula. Subversion interoperability (git-svn) is now in the `git-svn` formula. zsh completions and functions have been installed to: /opt/homebrew/share/zsh/site-functions ==> Summary 🍺 /opt/homebrew/Cellar/git/2.43.0: 1,638 files, 50.5MB ==> Running `brew cleanup git`... Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP. Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`). ==> Caveats ==> git The Tcl/Tk GUIs (e.g. gitk, git-gui) are now in the `git-gui` formula. Subversion interoperability (git-svn) is now in the `git-svn` formula. zsh completions and functions have been installed to: /opt/homebrew/share/zsh/site-functions |
重新打开一个终端,输入:git version
,就会发现已经是最新了~
1 2 |
$ git version git version 2.43.0 |
有可能你安装Git
之后还是原来的版本,那就重新链接一下就行了~
brew link git --overwrite
此时git
的地址变为了:
1 2 |
$ which git /opt/homebrew/bin/git |
本文最后更新于2024年2月2日,已超过 1 年没有更新,如果文章内容或图片资源失效,请留言反馈,我们会及时处理,谢谢!