Lesson 1: Getting Started with Homebrew
What is Homebrew?
Homebrew is a package manager for macOS that allows you to easily install and manage a variety of software packages. It provides a simple and effective way to install and update software on your Mac without having to search for and download packages manually.
Installing Homebrew on your Mac
To install Homebrew, check out the latest instructions on the Homebrew website (https://brew.sh/).
Basically, you can follow these steps:
- Open Terminal (you can find it in the Utilities folder in your Applications folder).
- Copy, paste, and run the following command:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- The command will prompt you to install the Xcode Command Line Tools if you do not already have them installed. Follow the prompts to install them.
- Once Homebrew is installed, you can start using it to install software packages.
Searching for packages
To search for packages using Homebrew, use the brew search
command followed by the name of the package you’re looking for.
For example, to search for the packages whose names contain “get”, type the following command:
brew search get
This will display a list of packages matching your search term.
You can also use the --desc
option to search for packages by description.
Getting information about packages
Before installing a package, you may want to get more information about it. To do this, use the brew info command followed by the name of the package. For example, to get information about the wget package, run:
brew info wget
This will show information about the package, including its version, dependencies, and installation instructions.
Installing packages
To install a package using Homebrew, use the brew install
command followed by the name of the package.
For example, to install the wget package, type the following command:
brew install wget
Homebrew will download and install the package and any necessary dependencies.
If you want to install a specific version of a package, you can specify the version number using the @ symbol. For example, to install version 1.21 of the wget package, you would enter:
brew install [email protected]
Uninstalling packages
To uninstall a package using Homebrew, use the brew uninstall
command followed by the name of the package.
For example, to uninstall the wget package, type the following command:
brew uninstall wget
Homebrew will remove the package and any dependencies that are no longer needed.
Updating Homebrew and its packages
To update Homebrew itself, use the brew update
command:
brew update
This will update the Homebrew package list and any other necessary components.
To update installed packages, use the brew upgrade
command.
For example, to update the wget package, type the following command:
brew upgrade wget
This will update the wget package and any dependencies that need to be updated.
Wrap-up
Congratulations on completing Lesson 1 of our Homebrew micro-course! You should now have a good understanding of what Homebrew is, how to install it, and how to use it to search for, install, and uninstall packages on your Mac. In the next lesson, we will cover more advanced Homebrew techniques, including tapping external repositories and creating your own Homebrew packages.