iTranslated by AI
[Mac] Homebrew for Beginners
Introduction
This time, I'm writing about Homebrew.
Homebrew is a package management tool that runs on macOS, and you can use it to install various packages.
Environment
The following environment is assumed.
- Device:
MacBook Pro (15-inch, 2017) - OS:
macOS Big Sur @ 11.1
What is Homebrew?
Homebrew is a package management system.
When developing, you need to install various packages of all sizes on your machine.
Homebrew allows you to centrally manage their versions, dependencies, and so on.
A similar tool is macports.
Installation
Access the official website from the link below.
You should see a screen similar to the one shown below.
The command displayed in the center of the screen is the script for installing Homebrew on your machine.
On my machine, the command was as follows.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
By copying this command and running it in the Terminal, and following the instructions displayed on the screen, the installation of Homebrew will be performed automatically.
Verification after installation
Check the version of Homebrew that was installed using the brew --version command.
brew --version
If the version is displayed as shown below, the installation was successful.
Homebrew 2.6.0
Main Usage
Basically, it is used in the following ways.
Installing Packages
Installation is done with the following command.
brew install [package_name]
Installable Packages
Packages that can be installed are listed on the following official page:
Uninstalling Packages
Delete a package using the uninstall command.
brew uninstall [package_name]
Upgrading Packages
Use the upgrade command to bring installed packages up to date.
You can also specify an individual upgrade by providing the package name.
# Upgrade all
brew upgrade
# Upgrade individually
brew upgrade [package_name]
Checking for packages that have upgrades
You can check for available upgrades with the outdated command.
brew outdated
If there are upgrades available, they will be displayed as follows.
*The current version is in parentheses, and the latest version available for upgrade is on the right.
aom (2.0.0) < 2.0.1
Checking installed packages
List the installed packages using the list command.
brew list
Output
aom leptonica p11-kit
autoconf libass pango
...omitted
Summary
In this article, I introduced the installation and basic usage of Homebrew.
It is no exaggeration to say that Homebrew is almost certainly used when developing with any language or framework on a Mac, and it appears in various articles and books.
Since it is not a difficult tool to handle, if you have a Mac, let's install and use it.
Discussion