Homebrew is a popular package manager for macOS that makes it easy to install and manage software packages. Here's how to install and use Homebrew on macOS:
Install Homebrew:
-
Open Terminal:
-
Launch the Terminal application. You can do this by searching for "Terminal" in Spotlight or by going to
Applications > Utilities > Terminal
.
-
Launch the Terminal application. You can do this by searching for "Terminal" in Spotlight or by going to
-
Run the Installation Command:
-
To install Homebrew, run the following command in Terminal:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- This command will download and run the Homebrew installation script from the official GitHub repository.
-
To install Homebrew, run the following command in Terminal:
-
Follow the Installation Prompts:
- During the installation process, you might be asked for your password to grant the script necessary permissions.
- The installation script will automatically set up Homebrew and its environment.
-
Configure Your Shell Profile (optional):
-
Homebrew will configure your shell profile automatically in most cases. However, if it doesn't, you might need to add the following line to your
.zshrc or .bash_profile
file:
export PATH="/usr/local/bin:$PATH"
-
Homebrew will configure your shell profile automatically in most cases. However, if it doesn't, you might need to add the following line to your
-
Verify the Installation:
-
Once the installation is complete, verify that Homebrew was installed correctly by running:
brew --version
-
Once the installation is complete, verify that Homebrew was installed correctly by running:
Using Homebrew:
-
Search for Packages:
-
To search for a package, use the following command:
brew search package_name
-
To search for a package, use the following command:
-
Install a Package:
-
To install a package, use the
brew install
command:
brew install package_name
-
To install a package, use the
-
Uninstall a Package:
-
To uninstall a package, use the
brew uninstall
command:
brew uninstall package_name
-
To uninstall a package, use the
-
Update Homebrew:
- To update Homebrew itself and its list of available packages, run:
brew update
-
Upgrade Installed Packages:
- To upgrade installed packages to their latest versions, run:
brew upgrade
-
List Installed Packages:
- To list all packages currently installed with Homebrew, run:
brew list
-
Get Information about a Package:
- To get information about an installed package or one available for installation, use:
brew info package_name
-
Clean Up Old Versions and Cache:
- To clean up old versions and cache files, run:
brew cleanup
That's it! With Homebrew installed, you can easily manage software packages on your macOS system.