欢迎访问 生活随笔!

生活随笔

当前位置: 首页 >

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

发布时间:2023/12/15 39 豆豆
生活随笔 收集整理的这篇文章主要介绍了 升级到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命令:

$ gitYou 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 AgreementPLEASE 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/2019Agreeing to the Xcode/iOS license requires admin privileges, please run “sudo xcodebuild -license” and then retry this command.

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

$ sudo xcodebuild -licenseYou 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.jsonDaviddeMacBook-Pro:homebrew-core david$ git status On branch master Your branch is up to date with 'origin/master'.nothing to commit, working tree cleanDaviddeMacBook-Pro:homebrew-core david$ git pull

然后就可用了。

总结

以上是生活随笔为你收集整理的升级到BigSur无法使用git和brew解决办法的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。