1、正常安裝brew的方式見網上有很多,我安裝的時候由於中途電腦睡眠了,然后就出bug了。
2、這里提供一個另外的安裝思路。
3、首先安裝的時候報錯:
fatal: ambiguous argument 'refs/remotes/origin/master': unknown revision or path not in the working tree.
然后還報github安裝錯誤的。
==> Downloading and installing Homebrew...
remote: Enumerating objects: 5, done.
remote: Counting objects: 100% (5/5), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 5 (delta 3), reused 5 (delta 3), pack-reused 0
Unpacking objects: 100% (5/5), done.
From https://github.com/Homebrew/brew
145f29fc5..a98bbbc64 master -> origin/master
HEAD is now at a98bbbc64 Merge pull request #6305 from Homebrew/dependabot/bundler/docs/html-proofer-3.11.1
fatal: ambiguous argument 'refs/remotes/origin/master': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
^C-e:68:in `system': Interrupt
from -e:68:in `system'
from -e:360:in `block in <main>'
from -e:342:in `chdir'
from -e:342:in `<main>'
4、解決思路:
1)struckoverflow上給出的方法就是:
rm -rf /usr/local/var/homebrew/
這種方式我試了之后還是有問題,無法安裝。
2)第二種方法,先卸載再安裝
為什么要先卸載,因為之前安裝了一般,安裝的時候被告知已經有一個進程了,試了brew update還是不行
既然不行的話,那只能卸載重新安裝了。
卸載方式:
打開:
https://raw.githubusercontent.com/Homebrew/install/master/uninstall
然后將網頁上的內容保存下來,存儲為uninstall的文件名后
chmod 755 uninstall
./uninstall
之后輸入密碼,卸載完成。
重新安裝:
打開鏈接:
https://raw.githubusercontent.com/Homebrew/install/master/install
還是把網頁內容保存下來,命名為brew_install文件名
chmod 755 brew_install
./brew_insatll
輸入密碼,坐等安裝完成。
5、除了這些安裝方法之外,還可通過修改源地址的方式來提升下載速度。
之后就可以通過brew來安裝wget等工具了。