banner
Zekelui

ByteBites

🧠 全端開發|🧰 工具達人|📚 學習狂🧑‍💻 樂於助人|🤘 硬派工程師

Homebrew: The indispensable package manager for macOS

Homebrew is a free and open-source package manager that simplifies the installation and management of software on macOS. It provides a convenient way to install, update, and remove software packages from a large software repository, eliminating the hassle of manual downloading and configuring software.

Introduction to Homebrew#

Compared to traditional software installation methods, Homebrew has several advantages:

  • Easy installation and management: Homebrew allows you to install software using a single command (brew install <package_name>).
  • Extensive software repository: Homebrew provides a wide range of software, from development tools to productivity applications.
  • Simplified updates: You can easily update all installed software using the brew upgrade command.
  • Clean removal: The brew uninstall <package_name> command can cleanly remove software, including all related files.

Installing Homebrew#

Installing Homebrew on macOS is very simple, just run the following command in the terminal:

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

Common Commands#

Here are some common Homebrew commands:

  • Install software: brew install <package_name>
  • Update software: brew upgrade
  • Remove software: brew uninstall <package_name>
  • Search for software: brew search
  • List installed software: brew list
  • Display software information: brew info <package_name>
  • Clean up residual files: brew cleanup
  • Remove unused dependencies: brew autoremove

Advanced Usage#

In addition to basic commands, Homebrew also provides some advanced features:

Install a specific version of software: brew install @

Install software from source code: brew install --build-from-source <package_name>

Manage multiple software versions: brew link --overwrite @

Create your own Homebrew package: Refer to the official Homebrew documentation

Advanced Commands#

In addition to basic installation, update, and removal commands, Homebrew also provides some advanced commands to help you better manage software packages:

  • brew cleanup --prune=all: This command cleans up Homebrew's cache, including downloaded installation packages and old versions of software. The --prune=all option removes all cache files, freeing up more space.
  • brew autoremove: This command removes installed but no longer needed software packages. For example, if you remove one package and another package no longer depends on it, brew autoremove will automatically remove the latter.

Notes on Using Homebrew#

When using Homebrew, please note the following:

  • Software packages installed by Homebrew are located in the /usr/local/Cellar directory.
  • Do not use the sudo command with Homebrew. Homebrew is designed to run without administrator privileges.
  • Regularly update Homebrew itself. Use the brew update command to update Homebrew.
Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.