Homebrew-使用总结
报错
-
执行
brew update
命令,报错:fatal: Could not resolve HEAD to a revision Already up-to-date.
解决方法:
-
执行:
brew update --verbose
:执行结果:
Checking if we need to fetch /opt/homebrew... Checking if we need to fetch /opt/homebrew/Library/Taps/homebrew/homebrew-core... Fetching /opt/homebrew... Updating /opt/homebrew... Branch 'master' set up to track remote branch 'master' from 'origin'. Switched to and reset branch 'master' Your branch is up to date with 'origin/master'. Switched to and reset branch 'stable' Current branch stable is up to date. Updating /opt/homebrew/Library/Taps/homebrew/homebrew-core... fatal: Could not resolve HEAD to a revision Already up-to-date.
-
打开报错路径:
cd /opt/homebrew/Library/Taps/homebrew/homebrew-core
; -
执行:
ls -al
:执行结果:
total 0 drwxr-xr-x 3 hsh admin 96 10 14 16:27 . drwxr-xr-x 3 hsh admin 96 10 14 16:27 .. drwxr-xr-x 12 hsh admin 384 10 15 14:12 .git
-
执行
git fetch --prune origin
:执行结果:
remote: Enumerating objects: 3, done. remote: Counting objects: 100% (2/2), done. remote: Total 3 (delta 2), reused 2 (delta 2), pack-reused 1 Unpacking objects: 100% (3/3), 1.54 KiB | 92.00 KiB/s, done. From https://github.com/Homebrew/homebrew-core * [new branch] update-tflint.rb-1634223541 -> origin/update-tflint.rb-1634223541
-
执行
git pull --rebase origin master
:执行结果:
From https://github.com/Homebrew/homebrew-core * branch master -> FETCH_HEAD
-
成功后即可执行更新:
brew update
:执行结果:
Already up-to-date.
-
之后便可正常执行其他命令了
eg:
brew install rbenv ruby-build
;
-