升级到BigSur无法使用git和brew解决办法

Macbook 一直都没有升级,刚升级到BigSur,从High Sur升级到Big Sur, 结果brew 命令无法使用了。

问题


$ brew update
Error: 
  homebrew-core is a shallow clone.
To `brew update`, first run:
  git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow
This command may take a few minutes to run due to the large size of the repository.
This restriction has been made on GitHub's request because updating shallow
clones is an extremely expensive operation due to the tree layout and traffic of
Homebrew/homebrew-core and Homebrew/homebrew-cask. We don't do this for you
automatically to avoid repeatedly performing an expensive unshallow operation in
CI systems (which should instead be fixed to not use shallow clones). Sorry for
the inconvenience!

按照提示,执行 git ,结果也失败了


DaviddeMacBook-Pro:~ david$ git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
DaviddeMacBook-Pro:~ david$ git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
DaviddeMacBook-Pro:~ david$ git config --list
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
DaviddeMacBook-Pro:~ david$ git
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
DaviddeMacBook-Pro:~ david$ git
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

....


修复git命令

使用git命令:

$ git


You have not agreed to the Xcode license agreements. You must agree to both license agreements below in order to use Xcode.

Press the 'return' key to view the license agreements at '/Applications/Xcode.app/Contents/Resources/English.lproj/License.rtf'

Xcode and Apple SDKs Agreement

PLEASE SCROLL DOWN AND READ ALL OF THE FOLLOWING TERMS AND CONDITIONS CAREFULLY BEFORE USING THE APPLE SOFTWARE OR APPLE SERVICES.  THIS IS A LEGAL AGREEMENT BETWEEN YOU AND APPLE.  IF YOU AGREE TO BE BOUND BY ALL OF THE TERMS AND CONDITIONS, CLICK THE “AGREE” BUTTON.  BY CLICKING “AGREE” OR BY DOWNLOADING, USING OR COPYING ANY PART OF THIS APPLE SOFTWARE OR USING ANY PART OF THE APPLE SERVICES, YOU ARE AGREEING ON YOUR OWN BEHALF AND/OR ON BEHALF OF YOUR COMPANY OR ORGANIZATION TO THE TERMS AND CONDITIONS STATED BELOW.  IF YOU DO NOT OR CANNOT AGREE TO THE TERMS OF THIS AGREEMENT, YOU CANNOT USE THIS APPLE SOFTWARE OR THE APPLE SERVICES.  DO NOT DOWNLOAD OR USE THIS APPLE SOFTWARE OR APPLE SERVICES IN THAT CASE.


.......



8.7     Entire Agreement; Governing Language
This Agreement constitutes the entire agreement between the parties with respect to the use of the Apple Software and Apple Services licensed hereunder and supersedes all prior understandings regarding such subject matter.  Notwithstanding the foregoing, to the extent that You have entered into the Apple Developer Program License Agreement (PLA) with Apple and are validly licensed by Apple to exercise additional rights, or to use additional features or functionality of the Apple Software or Apple Services under the PLA, You acknowledge and agree that the PLA shall govern Your use of such additional rights and privileges.  No amendment to or modification of this Agreement will be binding unless in writing and signed by Apple.  The parties hereto confirm that they have requested that this Agreement and all related documents be drafted in English.  Les parties ont exigé que le présent contrat et tous les documents connexes soient rédigés en anglais. 


EA1647
8/7/2019


Agreeing to the Xcode/iOS license requires admin privileges, please run “sudo xcodebuild -license” and then retry this command.

好吧,按照提示,执行命令

$ sudo xcodebuild -license


You have not agreed to the Xcode license agreements. You must agree to both license agreements below in order to use Xcode.

Press the 'return' key to view the license agreements at '/Applications/Xcode.app/Contents/Resources/English.lproj/License.rtf'

Xcode and Apple SDKs Agreement

....

By typing 'agree' you are agreeing to the terms of the software license agreements. Type 'print' to print them or anything else to cancel, [agree, print, cancel] 

按照提示,输入agree.

然后git 命令可用了。


修复homebrew

现在可用更新brew了:

DaviddeMacBook-Pro:~ david$ cd /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/
DaviddeMacBook-Pro:homebrew-core david$ ls
Aliases				Formula				audit_exceptions		pypi_formula_mappings.json
CODEOWNERS			LICENSE.txt			cmd				style_exceptions
CONTRIBUTING.md			README.md			formula_renames.json		tap_migrations.json

DaviddeMacBook-Pro:homebrew-core david$ git status
On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean

DaviddeMacBook-Pro:homebrew-core david$ git pull


然后就可用了。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值