Homebrew and Package Management on macOS
Homebrew is a popular package manager for macOS that simplifies the installation of software.
Installing Homebrew
To install Homebrew, open Terminal and run the following command:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Using Homebrew
Installing Packages
-
Formulae: Install command-line tools and libraries.
brew install wget # Install wget brew install git # Install Git
-
Casks: Install macOS applications.
brew install --cask firefox # Install Firefox brew install --cask slack # Install Slack
Managing Packages
-
List Installed Packages:
brew list # List all installed formulae brew list --cask # List all installed casks
-
Upgrade Packages:
brew update # Update Homebrew and formulae brew upgrade # Upgrade all installed formulae brew upgrade --cask # Upgrade all installed casks
-
Remove Packages:
brew uninstall wget # Uninstall wget brew uninstall --cask firefox # Uninstall Firefox
Homebrew Services
Homebrew can also manage background services:
-
Start a Service:
brew services start mysql # Start MySQL service
-
Stop a Service:
brew services stop mysql # Stop MySQL service
-
List Services:
brew services list # List all services