HomeBrew 软件包管理工具,拥有安装、卸载、更新、查看、搜索等很多实用的功能。包管理工具可以让你安装和更新程序变得更方便。
Homebrew installs the stuff you need that Apple (or your Linux system) didn’t.
-
Install Home-brew
打开Terminal输入以下命令
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
备注:由于苹果新系统安全提升,禁止了直接执行远程脚本,macOS 10.15.3有时会出现以下错误:
curl: (35) LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to raw.githubusercontent.com:443 。
此时需要把脚本文件下载到本地执行
- 复制https://raw.githubusercontent.com/Homebrew/install/master/install.sh到浏览器打开(需要梯子)
- 保存脚本到本地brew_install.sh
- 打开终端至脚本目录执行
bash brew_install.sh
兼容问题
- macOS Big Sur 11.0 Beta版(20A5343i),安装Brewhome之后不能使用Brew update命令,出现symbol '_ffi_prep_closure' not found,出现如下错误:
/Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:92:in `require': dlopen(/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/universal-darwin20/fiddle.bundle, 0x0009): symbol '_ffi_prep_closure' not found, expected in flat namespace by '/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/universal-darwin20/fiddle.bundle' - /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/universal-darwin20/fiddle.bundle (LoadError)
解决办法,输入以下命令
cd "$(mktemp -d)" \
&& git clone https://github.com/ruby/fiddle \
&& cd fiddle \
&& bundle install --path vendor/bundle \
&& bundle exec rake build \
&& sudo gem install pkg/fiddle-1.0.1.gem