访问官网:http://brew.sh
启动Terminal,依照官网指示输入安装命令
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
使用brew命令
sotary@Macbook-Pro-512GB ~ % brew help Example usage: brew search [TEXT|/REGEX/] brew info [FORMULA...] brew install FORMULA... brew update brew upgrade [FORMULA...] brew uninstall FORMULA... brew list [FORMULA...] Troubleshooting: brew config brew doctor brew install --verbose --debug FORMULA Contributing: brew create [URL [--no-fetch]] brew edit [FORMULA...] Further help: brew commands brew help [COMMAND] man brew https://docs.brew.sh
常见的错误提示
curl: (60) SSL certificate problem: self signed certificate
curl: (60) SSL certificate problem: self signed certificate More details here: https://curl.haxx.se/docs/sslcerts.html curl failed to verify the legitimacy of the server and therefore could not establish a secure connection to it. To learn more about this situation and how to fix it, please visit the web page mentioned above.
解决方法1:在终端中使用代理
# export https_proxy=http://127.0.0.1:7890 http_proxy=http://127.0.0.1:7890 all_proxy=socks5://127.0.0.1:7891
然后再次执行安装命令
# /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
==> /usr/bin/sudo /bin/mkdir -p /Users/sotary/Library/Caches/Homebrew ==> /usr/bin/sudo /bin/chmod g+rwx /Users/sotary/Library/Caches/Homebrew ==> /usr/bin/sudo /usr/sbin/chown sotary /Users/sotary/Library/Caches/Homebrew ==> Downloading and installing Homebrew... remote: Enumerating objects: 5, done. remote: Counting objects: 100% (5/5), done. remote: Compressing objects: 100% (5/5), done. remote: Total 5 (delta 0), reused 0 (delta 0), pack-reused 0 Unpacking objects: 100% (5/5), done. From https://github.com/Homebrew/brew * [new branch] dependabot/bundler/Library/Homebrew/i18n-1.8.4 -> origin/dependabot/bundler/Library/Homebrew/i18n-1.8.4 HEAD is now at 162ee3c2d Merge pull request #8031 from Rylan12/long-pythonhosted Updated 1 tap (homebrew/core). ==> New Formulae arrayfire cubejs-cli ksync lunchy-go notmuch-mutt z.lua cadence dnsprobe kubie marked simdjson croaring kona lunchy naabu subfinder
安装成功完成后应该出现如下提示:
==> Next steps: - Run `brew help` to get started - Further documentation: https://docs.brew.sh
解决方法2:
这是从Github服务器上获取Hombrew,当没有VPN或者梯子的时候用……
使用Ruby命令行,macOS自带ruby环境
/usr/bin/ruby -e "$(curl -fsSLk https://raw.githubusercontent.com/Homebrew/install/master/install)"
会出现一个警告,但是没关系,忽略它然后输入密码继续安装
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)"