mac命令行安装brew
删除方法
一、安装方法
- 1、打开链接:
https://raw.githubusercontent.com/Homebrew/install/master/install
- 2、把网页内容保存下来,命名为brew_install文件名
chmod 755 brew_install
./brew_insatll
- 3、输入密码
安装成功如下:
二、问题解决
问题1
问题描述:
fatal: unable to access 'https://github.com/Homebrew/brew/': Failed to connect to github.com port 443: Operation timed out
Failed during: git fetch --force --tags origin
解决方案:
- 1、Ping github.com 获取其IP:
- 2、在etc/hosts末尾后添加
sudo vim /etc/hosts
13.250.177.223 github.com
问题2
问题描述:
error: Not a valid ref: refs/remotes/origin/master
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>...]'
解决方案:
由于安装失败后重装导致的安装冲突,卸载后重装。
打开https://raw.githubusercontent.com/Homebrew/install/master/uninstall
然后将网页上的内容保存下来,存储为brew_uninstall的文件名后执行即可:
vim brew_uninstall
chmod 755 brew_uninstall
./brew_uninstall
rm -rf /usr/local/var/homebrew/
./brew_install
三、最后
mac使用起来感觉遇到的问题还蛮多的,坑到处都是,安装androidStudio遇到了一堆问题,找到可以使用brew安装一些内容,然后brew安装也是一堆坑,很奇怪哈。