2

安装HomeBrew的两种方法

 3 years ago
source link: https://felixxiong.github.io/2020/07/05/%E5%AE%89%E8%A3%85HomeBrew%E7%9A%84%E4%B8%A4%E7%A7%8D%E6%96%B9%E6%B3%95/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

安装HomeBrew的两种方法

2020-07-05

| 产品

插件/扩展

|

|

| 112

357

|

1

安装HomeBrew步骤在我的老博客写过,目前国内环境中安装会出现标题所述的错误:

curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused

解决方案一:保存文件

常规网上的方法都是用链接里的文件保存(install.rb)之后执行ruby的方法。

若根据参考链接里的最高赞里的链接进行保存文件:

https://raw.githubusercontent.com/Homebrew/install/master/install

现在此链接已经失效,网页内容为:

#!/usr/bin/ruby

STDERR.print <<EOS
Warning: The Ruby Homebrew installer is now deprecated and has been rewritten in
Bash. Please migrate to the following command:
  /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

EOS

Kernel.exec "/bin/bash", "-c", '/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"'

所以目前保存文件的链接应为:

https://raw.githubusercontent.com/Homebrew/install/master/install.sh

可能出错的注意点

保存了install.rb文件后,终端中进入相应目录(cd),报错:

Traceback (most recent call last):

ruby: no Ruby script found in input (LoadError)

解决方案2:使用命令安装

根据我在StarkOverflow上的提问,根据参考链接3中的回答:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

使用此命令即可输入密码并安装。

Homebrew installation on Mac OS X Failed to connect to raw.githubusercontent.com port 443

Why is no Ruby script found in input (LoadError)?

How to Install Packages with Homebrew for OS X

FelixXiong wechat
产品北里,讲述产品和人性、涉及设计、技术和运营的公众号。
你们的赞赏是我更新的动力~

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK