How to install Homebrew on OS X?
我正在尝试在OS X上安装Homebrew。
根据自制网站,我应该输入
1 | brew install wget |
我得到的只是
1 | -bash: brew: command not found |
所以我搜索了stackoverflow并找到了这个答案。但问题是,我在
因此,我还将以下行添加到我的
1 | export PATH=/usr/local/bin:$PATH |
但我还是得到了
如何在OS X上安装自制啤酒?
它在自制主页的顶部。
从终端提示:
1 | ruby -e"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" |
命令
检查是否安装了xcode:
1 2 3 4 5 6 7 | $ gcc --version $ ruby -e"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" $ brew doctor $ brew update. |
http://techsharehub.blogspot.com/2013/08/brew-command-not-found.html"单击此处获取准确的指令更新"
我可能会迟到,但有一个很酷的网站,你可以在那里搜索软件包,它会列出安装这些软件所需的命令。BrewInstall是网站。
但是,可以使用以下命令安装wget:
1 2 | ruby -e"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" brew install wget |
希望这有帮助:)
在开箱即用的Macos High Sierra 10.13.6上
1 | $ ruby -e"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" |
给出以下错误:
curl performs SSL certificate verification by default, using a"bundle"
of Certificate Authority (CA) public keys (CA certs). If the default
bundle file isn't adequate, you can specify an alternate file
using the --cacert option.If this HTTPS server uses a certificate signed by a CA represented in
the bundle, the certificate verification probably failed due to a
problem with the certificate (it might be expired, or the name might
not match the domain name in the URL).If you'd like to turn off curl's verification of the certificate, use
the -k (or --insecure) option.HTTPS-proxy has similar options --proxy-cacert and --proxy-insecure.
解决方案:只需在你的卷发选项中添加K即可。
1 | $ ruby -e"$(curl -fsSLk https://raw.githubusercontent.com/Homebrew/install/master/install)" |
以下是一个将自制安装程序包装在bash函数中的版本,该函数可以从部署脚本中运行:
1 2 3 4 5 6 7 8 9 10 11 | install_homebrew_if_not_present() { echo"Checking for homebrew installation" which -s brew if [[ $? != 0 ]] ; then echo"Homebrew not found. Installing..." ruby -e"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" else echo"Homebrew already installed! Updating..." brew update fi } |
以及另一个函数,如果尚未安装自制公式,则将安装该函数:
1 2 3 4 5 6 7 8 | brew_install () { if brew ls --versions $1 > /dev/null; then echo"already installed: $1" else echo"Installing forumula: $1..." brew install $1 fi } |
一旦定义了这些函数,就可以在bash脚本中使用它们,如下所示:
1 2 3 4 | install_homebrew_if_not_present brew_install wget brew_install openssl ... |
如果运行后仍然出错,
1 | ruby -e"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" |
然后尝试从https://developer.apple.com/download/more/下载并安装特定Mac OS和Xcode版本的命令行工具。
然后试着跑,
1 | /usr/bin/ruby -e"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" |
然后
1 | brew install node |
如果您在代理服务器下,以下命令将不起作用。
而是用户跟踪-
1 | ruby -e"$(curl -x http://DOMAIN%5cUSER_NAME:PASSWORD@PROXY:PORT -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" |
注意:如果您的密码有任何特殊字符,我们必须使用%5C而不是""。请用Unicode替换它,例如@use%40。引用此单播
用您自己的参数替换上面的命令
域-您的域
用户名-您的用户名
密码-密码
代理-10.10.10.10
端口8080
在终端中添加以下内容,然后单击Enter,然后按照终端中的说明进行操作。
脚本如下:
/usr/bin/ruby -e"$(curl -fsSL
https://raw.githubusercontent.com/Homebrew/install/master/install)"
在尝试了所有描述之后,我查看了/usr/local/etc/中BREW的文件夹权限。不知怎么的,权限被更改了,我无法打开文件夹。我用与其他文件夹相同的权限更改了文件夹权限(使用chmod),BREW开始工作。