The Homebrew package manager will let you install software related to the command line and tools on Mac with ease. You can download and install any package using Homebrew.
With the Homebrew package manager, it is possible for mac users to access the Unix command line, and more.
By the end of this article, you will know how to install and uninstall packages with Homebrew. It is advised to read the whole article till the end. Without further ado, let’s get started.
See also: Mac Activity Monitor Explained | Mac Task Manager
Requirements to install Homebrew Package manager on macOS
Following are the requirements, that Mac users supposed to meet before installing the Homebrew Package manager.
- macOS Mojave 10.14 or later.
- 64-bit system or Apple Silicon CPU
- A command-line tools for Xcode
Things to know before installing Homebrew Package manager on macOS
It is always better to install Homebrew and it’s packaged under the specific directory, Following is the path where it is advised to install Homebrew depending upon your CPU architecture.
- /usr/local on macOS Intel
- /opt/homebrew on macOS ARM (M1)
How to install Homebrew package manager
To do so, users need to do the following:
Step 1: Installing Xcode
In order to install Homebrew on your Mac, we need to install Xcode (a command-line tool) first. Here’s how you can do that:
- Go to the Terminal.
- If you have kept the password to open your Mac user’s account, you will be asked to enter the password to open the Terminal.
- Type the command at bash/zsh prompt: xcode-select –install
- A window will popup ask you to confirm the Xcode installation, click on Install.
- Once the installation is finished click on Done.
On the other side, you can check whether Xcode Command Line Tools is installed, use the command mentioned below to verify:
Step 2: Installing Homebrew on macOS
Once you have installed Xcode Command Line Tools, the next step is to install Homebrew on macOS, which is quite easy to do.
- Open Terminal.
- Paste the following command in the Terminal:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
If you have kept the password to open your Mac user’s account, you will be asked to enter the password, enter your password and Homebrew will start installing automatically.
Uninstall or Remove Homebrew Packages
Uninstalling a package from Homebrew is easy and fast, good thing is that we don’t need any other program to download.
We will do this by using two commands and that is to uninstall and remove. But are these two commands are same? and how they look?
The following table will give you the whole idea:
|Command Used For||Command|
|To Uninstall Homebrew package|
|To Remove Homebrew package|
As you can see from the table mentioned above, uninstall and remove commands are the same and will provide you a similar outcome; the removal of the Homebrew package.
For a demonstration purpose, we will show you how to uninstall links (if you have installed links on your Mac with Homebrew). Here’s how to do that by using the following command string:
brew uninstall links
An alternate way to remove the command for a similar effect:
brew remove links
In case, you are not sure whether the Homebrew package is uninstalled, you can check that by running the command again.
Uninstall Homebrew Packages by Controlling Dependencies
You might be not aware of this fact that when you decide to uninstall or remove a package from Homebrew.
That package might have dependencies that let other packages work, if somehow you have deleted the main package this will affect the other Homebrew packages, resulting in misbehavior or unable to work.
Here’s how you can prevent the situation, by deleting a Homebrew package without affecting the dependencies flag. Let’s say we are uninstalling the links package.
brew uninstall --ignore-dependencies links
By referring to the command line mentioned above, you will be on the safer side.
How to know if a Homebrew package you want to Uninstall or Remove has dependencies?
Sometimes there are situations where you completely unaware of whether the Homebrew package that you want to delete has dependencies or not.
How do know that? Let’s say that you have installed python 3 on the Mac. As soon as you executed that command, it will look like something link the following:
% brew deps python3 gdbm openssl readline sqlite xz
Suppose if you completely try to delete the python 3 packages from Homebrew, another package will not work at all.
So it is advised to verify whether the Homebrew package that you will be going to delete has dependency flags or not. Else, you could run into the trouble of letting other Homebrew packages not work.
That’s it for now, hope this helps! We are glad to know your thoughts in the comment section below. Till then, stay tuned for more info.
See next: How to Find your Mac’s IP address