/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
from brew.sh
或者 执行
- $ cd ~
- $ curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh) >> brew
- $ /bin/bash -c “$(cat brew)”
You should execute this command at morning, because the USA is night when we are at morning, so that net speed is fast.
在安装时会遇到一些错误,比如 error 54 , LibreSSL 错误,其实都是由于网速太慢导致的,有的人说要更改到 中科大 的源(https://mirrors.ustc.edu.cn/brew.git),
// 执行下面这句命令,更换为中科院的镜像: git clone
git://mirrors.ustc.edu.cn/homebrew-core.git/
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core --depth=1
cd “$(brew --repo)”git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
cd “$(brew --repo)/Library/Taps/homebrew/homebrew-core”
git remote set-url origin
https://mirrors.ustc.edu.cn/homebrew-core.git// 更新 brew update
但是我没有采用,或者说采用了也没用。 以前使用 /usr/bin/ruby brew_install 方式安装,现在已经是 /bin/bash 方式。
遇到错误,我使用 brew doctor 耐心地重复几次,就能成功!(ga ba de !)
curl 可以不用交互地下载http 文件
-f
Fail silently (no output at all) on server errors.
-S, --show-error
When used with -s, --silent, it makes curl show an error message if it fails.
-s, --silent
Silent or quiet mode. Don't show progress meter or error messages. Makes Curl mute. It will still output the data you ask or, potentially even to the terminal/stdout unless you redirect it.
homebrew常用操作:
brew install xxx 安装xxx
brew uninstall xxx 卸载xxx
brew update xxx 更新xxx
brew doctor 修复brew
Install Brew in 2020, need 4 steps:
Page : https://docs.brew.sh/Installation
macOS Requirements
A 64-bit Intel CPU 1
macOS High Sierra (10.13) (or higher) 2
Command Line Tools (CLT) for Xcode: xcode-select --install, developer.apple.com/downloads or Xcode 3
A Bourne-compatible shell for installation (e.g. bash or zsh) 4
like me , download 3 : Command_Line_Tools_macOS_10.13_for_Xcode_9.3.dmg
from: https://developer.apple.com/download/more/