網頁

2022/11/12

Mac x86 安裝Homebrew

Mac安裝Homebrew套件管理工具。


範例環境

  • MacBook Pro 2020 X86
  • macOS Ventura 13.0
  • Zsh shell


安裝 Install

開啟終端機(Terminal)命令列工具,複製官網的安裝命令如下執行即可完成安裝。

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

命令執行過程如下。

% /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

==> Checking for `sudo` access (which may request your password)...
Password:
==> This script will install:
/usr/local/bin/brew
/usr/local/share/doc/homebrew
/usr/local/share/man/man1/brew.1
/usr/local/share/zsh/site-functions/_brew
/usr/local/etc/bash_completion.d/brew
/usr/local/Homebrew
==> The following new directories will be created:
/usr/local/bin
/usr/local/etc
/usr/local/include
/usr/local/lib
/usr/local/sbin
/usr/local/share
/usr/local/var
/usr/local/opt
/usr/local/share/zsh
/usr/local/share/zsh/site-functions
/usr/local/var/homebrew
/usr/local/var/homebrew/linked
/usr/local/Cellar
/usr/local/Caskroom
/usr/local/Frameworks
==> The Xcode Command Line Tools will be installed.

Press RETURN/ENTER to continue or any other key to abort:
==> /usr/bin/sudo /bin/mkdir -p /usr/local/bin /usr/local/etc /usr/local/include /usr/local/lib /usr/local/sbin /usr/local/share /usr/local/var /usr/local/opt /usr/local/share/zsh /usr/local/share/zsh/site-functions /usr/local/var/homebrew /usr/local/var/homebrew/linked /usr/local/Cellar /usr/local/Caskroom /usr/local/Frameworks
==> /usr/bin/sudo /bin/chmod ug=rwx /usr/local/bin /usr/local/etc /usr/local/include /usr/local/lib /usr/local/sbin /usr/local/share /usr/local/var /usr/local/opt /usr/local/share/zsh /usr/local/share/zsh/site-functions /usr/local/var/homebrew /usr/local/var/homebrew/linked /usr/local/Cellar /usr/local/Caskroom /usr/local/Frameworks
==> /usr/bin/sudo /bin/chmod go-w /usr/local/share/zsh /usr/local/share/zsh/site-functions
==> /usr/bin/sudo /usr/sbin/chown apple /usr/local/bin /usr/local/etc /usr/local/include /usr/local/lib /usr/local/sbin /usr/local/share /usr/local/var /usr/local/opt /usr/local/share/zsh /usr/local/share/zsh/site-functions /usr/local/var/homebrew /usr/local/var/homebrew/linked /usr/local/Cellar /usr/local/Caskroom /usr/local/Frameworks
==> /usr/bin/sudo /usr/bin/chgrp admin /usr/local/bin /usr/local/etc /usr/local/include /usr/local/lib /usr/local/sbin /usr/local/share /usr/local/var /usr/local/opt /usr/local/share/zsh /usr/local/share/zsh/site-functions /usr/local/var/homebrew /usr/local/var/homebrew/linked /usr/local/Cellar /usr/local/Caskroom /usr/local/Frameworks
==> /usr/bin/sudo /bin/mkdir -p /usr/local/Homebrew
==> /usr/bin/sudo /usr/sbin/chown -R apple:admin /usr/local/Homebrew
==> /usr/bin/sudo /bin/mkdir -p /Users/apple/Library/Caches/Homebrew
==> /usr/bin/sudo /bin/chmod g+rwx /Users/apple/Library/Caches/Homebrew
==> /usr/bin/sudo /usr/sbin/chown -R apple /Users/apple/Library/Caches/Homebrew
==> Searching online for the Command Line Tools
==> /usr/bin/sudo /usr/bin/touch /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
==> Installing Command Line Tools for Xcode-14.1
==> /usr/bin/sudo /usr/sbin/softwareupdate -i Command\ Line\ Tools\ for\ Xcode-14.1
Software Update Tool

Finding available software

Downloading Command Line Tools for Xcode
Downloaded Command Line Tools for Xcode
Installing Command Line Tools for Xcode
Done with Command Line Tools for Xcode
Done.
==> /usr/bin/sudo /usr/bin/xcode-select --switch /Library/Developer/CommandLineTools
Password:
Sorry, try again.
Password:
==> /usr/bin/sudo /bin/rm -f /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
==> Downloading and installing Homebrew...
remote: Enumerating objects: 220293, done.
remote: Counting objects: 100% (73/73), done.
remote: Compressing objects: 100% (67/67), done.
remote: Total 220293 (delta 11), reused 65 (delta 6), pack-reused 220220
Receiving objects: 100% (220293/220293), 61.99 MiB | 1.24 MiB/s, done.
Resolving deltas: 100% (162103/162103), done.
From https://github.com/Homebrew/brew
 * [new branch]          dependabot/bundler/Library/Homebrew/rubocop-1.38.0 -> origin/dependabot/bundler/Library/Homebrew/rubocop-1.38.0
 * [new branch]          less-agressive-core-tap -> origin/less-agressive-core-tap
 * [new branch]          master                  -> origin/master
 * [new tag]             0.1                     -> 0.1
...
 * [new tag]             3.6.9                   -> 3.6.9
HEAD is now at b683bebd2 Merge pull request #14139 from EricFromCanada/rubydoc-fixes
==> Tapping homebrew/core
remote: Enumerating objects: 1329575, done.
remote: Counting objects: 100% (292/292), done.
remote: Compressing objects: 100% (161/161), done.
remote: Total 1329575 (delta 145), reused 269 (delta 131), pack-reused 1329283
Receiving objects: 100% (1329575/1329575), 505.56 MiB | 1.49 MiB/s, done.
Resolving deltas: 100% (922410/922410), done.
From https://github.com/Homebrew/homebrew-core
 * [new branch]              master     -> origin/master
Updating files: 100% (6699/6699), done.
HEAD is now at d38f0f7b60a mediaconch: update 22.09 bottle.
==> Installation successful!

==> Homebrew has enabled anonymous aggregate formulae and cask analytics.
Read the analytics documentation (and how to opt-out) here:
  https://docs.brew.sh/Analytics
No analytics data has been sent yet (nor will any be during this install run).

==> Homebrew is run entirely by unpaid volunteers. Please consider donating:
  https://github.com/Homebrew/brew#donations

==> Next steps:
- Run brew help to get started
- Further documentation:
    https://docs.brew.sh

安裝時在下面步驟可能會卡一陣子(約5-10分鐘),持續等待安裝完畢即可。

  • /usr/bin/sudo /usr/bin/touch /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
  • Downloading Command Line Tools for Xcode

安裝完執行brew -v檢視目前版本。

% brew -v
Homebrew 3.6.10
Homebrew/homebrew-core (git revision d38f0f7b60a; last commit 2022-11-12)

輸入which brew顯示Homebrew命令執行檔位置為/usr/local/bin/brew

% which brew
/usr/local/bin/brew

沒有留言:

張貼留言