homebrew下/usr/local无使用权限及卸载提示curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused问题解决
查看权限,发现所属用户为root,homebrew禁止root用户操作,进行所属用户更改,操作被禁止。
d@luca /Users % ls -ld /usr/local
drwxr-xr-x 14 root wheel 448 11 13 15:48 /usr/local
d@luca /Users % sudo chown -R $(whoami) /usr/local/
Password:
chown: /usr/local/: Operation not permitted
想到自己太久没有homebrew,而该问题必然出现频率不低,新版本应已修复。
进行卸载
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
卸载不成功
curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection re
fused
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/universal-darwin19/rbconfig.rb:229: warning: Insecure world writable dir /usr/local/sbin in PATH, mode 040777
上网查阅发现是GitHub的raw.githubusercontent.com
域名解析被污染
进入https://githubusercontent.com.ipaddress.com查询raw.githubusercontent.com
真实ip
修改hosts
sudo vim/etc/hosts
添加(请注意查询更新域名信息)
199.232.96.133 raw.githubusercontent.com
运行
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
成功卸载
重装成功
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"