Homebrew - 基础命令和速查表
Homebrew 是一款免费开源的软件包管理系统,可以简化在 Apple macOS 操作系统上安装软件的过程。它被称为 macOS 上缺失的软件包管理器。
Homebrew 是用 Ruby 编程语言编写的,目标是 macOS 操作系统自带的 Ruby 版本。Homebrew 将软件包安装到它们自己的目录 (Cellar),然后将其文件符号链接到 /usr/local。
安装 Homebrew Basics
了解如何在 macOS 上安装 Homebrew 的最佳方式是访问 Homebrew 的主页。请点击以下链接:
Homebrew 命令
Brew 帮助
成功安装 brew 后,了解如何获取相关帮助非常重要。以下命令旨在提供有关如何在 macOS 上使用 brew 命令的帮助。
# Display the version of Homebrew.
$ brew --version
# Print Help Information
$ brew help
# Print Help Info for a brew command
$ brew help <sub-command>
# Check system for potential problems.
$ brew doctor
Brew 更新
Homebrew 的强大之处在于它能让你轻松地保持你的应用程序更新,并让其他应用程序保持特定版本。这些命令集用于更新 Homebrew 本身以及随其安装的应用程序。
# Fetch latest version of homebrew and formula
$ brew update
# Show formulae with an updated version available
$ brew outdated
# Upgrade all outdated and unpinned brews
$ brew upgrade
# Upgrade only the specified brew
$ brew upgrade <formula>
# Prevent the specified formulae from being upgraded
$ brew pin <formula>
# Allow the specified formulae to be upgraded.
$ brew unpin <formula>
Brew 存储库
可以使用brew tap命令向 Homebrew 添加其他软件仓库。这允许你安装默认软件仓库中没有的其他应用程序。
# List all the current tapped repositories (taps)
$ brew tap
# Tap a formula repository from Github using https for tap https://github.com/user/homebrew-repo
$ brew tap <user/repo>
# Tap a formula repository from the specified URL
$ brew tap <user/repo> <URL>
# Remove the given tap from the repository
$ brew untap <user/repo>
酿酒桶
Homebrew Cask 为以二进制形式分发的 macOS 应用程序的管理提供了友好的 CLI 工作流程。
# Tap the Cask repository from Github.
$ brew tap homebrew/cask
# List all the installed casks .
$ brew cask list
# Search all known casks based on the substring text.
$ brew search <text>
# Install the given cask.
$ brew cask install <cask>
# Reinstalls the given Cask
$ brew cask reinstall <cask>
# Uninstall the given cask.
$ brew cask uninstall <cask>
Brew 搜索、安装、删除
以下命令用于搜索、列出和安装 Homebrew 存储库中可用的不同应用程序和工具。
# List all the installed formulae.
$ brew list
# Display all locally available formulae for brewing.
$ brew search
# Perform a substring search of formulae names for brewing.
$ brew search <text>
# Display information about the formula.
$ brew info <formula>
# Install the formula.
$ brew install <formula>
# Uninstall the formula.
$ brew uninstall <formula>
酿造清理
删除陈旧的锁文件和过时的公式和桶的下载,并删除已安装公式的旧版本。
# Remove older versions of installed formulae.
$ brew cleanup
# Remove older versions of specified formula.
$ brew cleanup <formula>
# Display all formula that will be removed (dry run)
$ brew cleanup -n
提示和速查表
Brew 的 Cheatsheet 命令可以从下方链接下载。该 PDF 文档包含常用的 brew 命令列表。本 Cheatsheet 并非所有命令的完整列表,如需了解详情,请访问 Brew 官方文档页面。
在此处下载 PDF 版本:Homebrew Cheatsheet
安装文章
本节包含一系列文章,解释如何使用 Homebrew 在 macOS 上安装应用程序和命令行工具。
命令行工具和应用程序
本节中的工具和应用程序列表使用了brew install命令。
- 如何使用 Homebrew 在 macOS 上安装 ACK
- 如何使用 Homebrew 在 macOS 上安装 Apache Ant
- 如何使用 Homebrew 在 macOS 上安装 AWS CLI
- 如何使用 Homebrew 在 macOS 上安装 cURL
- 如何使用 Homebrew 在 macOS 上安装 Git
- 如何使用 Homebrew 在 macOS 上安装 Gradle
- 如何使用 Homebrew 在 macOS 上安装 Maven
- 如何使用 Homebrew 在 macOS 上安装 Node.js
- 如何使用 Homebrew 在 macOS 上安装 Vagrant
- 如何使用 Homebrew 在 macOS 上安装 Wget
开发应用程序
本节中的应用程序列表使用了brew cask install命令。
- 如何使用 Homebrew 在 macOS 上安装 AppCode
- 如何使用 Homebrew 在 macOS 上安装 Atom
- 如何使用 Homebrew 在 macOS 上安装 DBeaver (CE)
- 如何使用 Homebrew 在 macOS 上安装 DBeaver(EE)
- 如何使用 Homebrew 在 macOS 上安装 DiffMerge
- 如何使用 Homebrew 在 macOS 上安装 Docker
- 如何使用 Homebrew 在 macOS 上安装 Eclipse
- 如何使用 Homebrew 在 macOS 上安装 Firefox
- 如何使用 Homebrew 在 macOS 上安装 Google Chrome
- 如何使用 Homebrew 在 macOS 上安装 Insomnia
- 如何使用 Homebrew 在 macOS 上安装 IntelliJ IDEA (CE)
- 如何使用 Homebrew 在 macOS 上安装 IntelliJ IDEA (UE)
- 如何使用 Homebrew 在 macOS 上安装 iTerm2
- 如何使用 Homebrew 在 macOS 上安装 Java
- 如何使用 Homebrew 在 macOS 上安装 Postman
- 如何使用 Homebrew 在 macOS 上安装 Slack
- 如何使用 Homebrew 在 macOS 上安装 Spring Tool Suite(STS)
- 如何使用 Homebrew 在 macOS 上安装 Sublime Text
- 如何使用 Homebrew 在 macOS 上安装 Tower
- 如何使用 Homebrew 在 macOS 上安装 Virtualbox
- 如何使用 Homebrew 在 macOS 上安装 Visual Studio Code
- 如何使用 Homebrew 在 macOS 上安装 WebStorm
结论
希望本文能帮助您使用 Homebrew 在 Mac 上安装和管理应用程序。欢迎分享这份速查表,并评论您在使用过程中遇到的任何问题。
文章来源:https://dev.to/andremare/homebrew---basics--cheatsheet-3a3n