跳至主要内容

homebrew-bundle

Homebrew 也開始支援 linux, 可能未來部分 Linux 上的工具會改用 homebrew 來安裝, 避免不同 Linux distro package manager 版本不一的問題.

homebrew-bundle 類似 node 中的 package.json / go 的 go.mod, 把想要安裝的套件寫在 Brewfile 中, 執行 brew bundle 即可以安裝所有套件.

也可以利用 homebrew-bundle 來備份所有已安裝的套件, 在新電腦無痛安裝.

Requirement

  • Homebrew (on macOS or Linux) for installing dependencies.
  • Homebrew Cask is optional and used for installing Mac applications.
  • mas-cli is optional and used for installing Mac App Store applications.
  • Whalebrew is optional and used for installing Whalebrew images.
  • Visual Studio Code is optional and used for installing Visual Studio Code extensions.

備份方式

brew bundle dump --describe --force --file="~/Desktop/Brewfile"
  • --describe:为列表中的命令行工具加上说明性文字。
  • --force:直接覆盖之前生成的Brewfile文件。如果没有该参数,则询问你是否覆盖。
  • --file="~/Desktop/Brewfile":在指定位置生成文件。如果没有该参数,则在当前目录生成 Brewfile 文件。

還原

brew bundle --file="~/Desktop/Brewfile"

See Also