Homebrew是一款Mac OS平台下的软件包管理工具,拥有安装、卸载、更新、查看、搜索等很多实用的功能。简单的一条指令,就可以实现包管理,而不用你关心各种依赖和文件路径的情况,十分方便快捷
Homebrew 是最简单和灵活的方式,用来在 Mac OS X 安装 Linux 工具包。
安装 Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
将以上命令粘贴至终端。
脚本会在执行前暂停,并说明它将做什么。
Homebrew 能干什么?
使用 Homebrew 安装 Apple(或您的 Linux 系统)没有预装但你需要的东西。
$ brew install wget
Homebrew 会将软件包安装到独立目录,并将其文件软链接至 /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/wget
Homebrew 不会将文件安装到它本身目录之外,所以您可将 Homebrew 安装到任意位置。
轻松创建你自己的 Homebrew 包。
$ 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 的配方都是简单的 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
end
Homebrew 使 macOS(或您的 Linux 系统)更完整。使用 gem 来安装 RubyGems、用 brew 来安装那些依赖包。
“要安装,请拖动此图标……”不会再出现了。使用 Homebrew Cask 安装 macOS 应用程序、字体和插件以及其他非开源软件。
$ brew install --cask firefox
制作一个 cask 就像创建一个配方一样简单。
$ brew create --cask foo
Editing /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask/Casks/foo.rb
发生了什么变化
修复错字(“新公式”应为“新公式”)@pbx在#19171
utils/curl:修复user_agent类型@zyoshoka在#19172
实施修复和评论DisableCommentRubocop@koddsson在#19168
dev-cmd/瓶:在不需要时不要安装gnu-tar@Bo98在#19180
utils/github:修复GraphQl错误日志@zyoshoka在#19182中
TAP命令:正确的Helpext -Repair@rrotter在#19189
更新Formula_Creator.rb by@BingoKingo在#19173
通过@koddsson在#18842中
使用全终端高度并发输出。经过@reitermarkus在#19194
重命名aarch64_linux标签为am64_linux@Bo98在#19188中
添加Alast_reviewed_date到Docs Metadata@issyl0在#19200
DEV-CMD/LIVECHECK:当所有公式均由自动化时,改进错误消息@nandahkrishna在#19201
打印并发下载错误。经过@reitermarkus在#19206
文档:/opt/homebrew在示例中更喜欢@EricFromCanada在#19209
桶/文物/安装程序:如果使用sudo,请勿重置UID。经过@MikeMcQuaid在#19218中