MacOS下安装brew时报错port 443: Connection refused的解决方案(最全)

方案一、重装command line tools

removing the old tools ($ rm -rf /Library/Developer/CommandLineTools)
install xcode command line tools again ($ xcode-select --install).
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

 

方案二、利用gem安装redis服务

sudo gem install redis

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

 

方案三、还原hosts

sudo -i
cd /etc
rm hosts
vi hosts

复制下面内容,wq保存退出即可

# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

你可能感兴趣的:(MacOS,brew,报错,解决方案)