/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
在終端機命令列提示貼上這個。
腳本執行時會解釋它正在做什麼,並在你確認之前暫停下來。你可以在這裡找到更多安裝選擇 (required for Linux and Windows Subsystem for Linux)。
Homebrew 會將 packages 安裝在他們自己的目錄,然後把檔案 symlink 到 /usr/local 下。
$ cd /usr/local
$ find Cellar
Cellar/wget/1.16.1
Cellar/wget/1.16.1/bin/wget
Cellar/wget/1.16.1/share/man/man1/wget.1
$ ls -l bin
bin/wget -> ../Cellar/wget/1.16.1/bin/wgetHomebrew 不會把檔案放在預設路徑之外的地方,因此可以在任何位置使用 Homebrew 安裝程式。
輕鬆建立你自己的 Homebrew packages。
$ brew create https://foo.com/bar-1.0.tgz
Created /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/bar.rb完全以 Git 和 Ruby 為基底,所以你可以盡情地運用這些知識,輕鬆地復原你的修改以及合併上游的更新。
$ brew edit wget # 使用 $EDITOR 編輯!Homebrew 的 formula 都是簡單的 Ruby 腳本:
class Wget < Formula
homepage "https://www.gnu.org/software/wget/"
url "https://ftp.gnu.org/gnu/wget/wget-1.15.tar.gz"
sha256 "52126be8cf1bddd7536886e74c053ad7d0ed2aa89b4b630f76785bac21695fcd"
def install
system "./configure", "--prefix=#{prefix}"
system "make", "install"
end
endHomebrew 互補了 macOS,你可以使用 gem 來安裝 Ruby 套件, 而它的依存軟體可以用 brew 安裝。
"To install, drag this icon..." no more. brew cask installs macOS apps, fonts and plugins and other non-open source software.
$ brew cask install firefoxMaking a cask is as simple as creating a formula.
$ brew cask create foo
Editing /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask/Casks/foo.rbHomebrew was created by Max Howell. Website by Rémi Prévost, Mike McQuaid and Danielle Lalonde.