Best VPS Hosting | Website Hosting Pakistan | Domain & Hosting Services

Are you looking for steps to install Homebrew on Mac? Take a peek at this blog.

Here at Bobcares, we have seen several such Mac-related queries as part of our Server Management Services for web hosts and online service providers.

Today we’ll see how to install Homebrew on Mac.


A few facts about Homebrew

Homebrew is a free and open-source package manager for macOS.

It mainly simplifies the installation of software on Apple’s macOS operating system and Linux. In short, it acts as a command-line App store.

Moreover, it helps you in avoiding the possible security problems associated with using the Sudo command.


How to install Homebrew on Mac

Now let’s take a look at how our Support Engineers install Homebrew on Mac.


1. Using the mac Terminal

By default, a terminal application is provided by macOS. So you can access it by going to Finder, navigating to the Applications folder, and then into the ‘utilities’ folder. Then from here, double-click on the Terminal application to open it up.


2. Install Xcode’s Command Line Tools

Xcode is an integrated development environment (IDE) that has software development tools for macOS. You don’t need the Xcode for using Homebrew but some of the software and components you’ll want to install will rely on Xcode’s Command Line Tools package.

Run the below command in the Terminal to download and install these components:

$ xcode-select --install

Now you will be asked to start the installation and then again you will be prompted to accept a software license. After your confirmation, the tools will download and install automatically.


3. Install and Set Up Homebrew

To install Homebrew, you will need to download an installation script and then execute the script.

So first, download the script to your local machine. For that, run the below command.

$ curl -fsSL -o

This command uses the curl to download the Homebrew installation script from Homebrew’s Git repository on GitHub.

Before you run the script that you have downloaded from the internet, make sure to review its contents so you know what the script will do. So use the less command to look at the installation script.

$ less

Once you’re comfortable with the contents of the script, execute the script using the bash command as below.

$ /bin/bash

These scripts will explain what it will do and will prompt you to confirm that you want to do it. This will let you know what Homebrew is going to do to your system before you let it proceed.

Next, a prompt will appear which will ask you to enter the password. However, while entering the password the keystrokes don’t appear for security reasons. Then press the RETURN key once you’ve entered your password.

Press the letter y for “yes” whenever you are prompted to confirm the installation.

Once the installation completes, enter the directory Homebrew uses to store its executables at the front of the PATH environment variable. This will ensure that the Homebrew installations will be called over the tools that macOS includes.

The file you’ll modify depends on which shell you’re using. If you’re using Bash, you’ll use the file ~/.bash_profile:

nano ~/.bash_profile

However, if you’re using ZSH, you’ll open the file ~/.zshrc.

nano ~/.zshrc

After the opening of the file in the Terminal, add the following lines to the end of the file:

# Add Homebrew's executable directory to the front of the PATH
export PATH=/usr/local/bin:$PATH

To save your changes, hold down the CTRL key and the letter O, and when prompted, press the RETURN key. Then exit the editor by holding the CTRL key and pressing X. This will return you to your Terminal prompt.

In order to activate these changes, close and reopen your Terminal app. Then to load the file using the source command.

If you modified .bash_profile, run the below command.

$ source ~/.bash_profile

If you modified .zshrc, run the below command.

$ source ~/.zshrc

Now to verify if the Homebrew is set up correctly or not, run the below command.

$ brew doctor

As a result, it must display the below output.

Your system is ready to brew.


4. Installing, Upgrading, and Removing Packages

Now after the Homebrew installation, you can use it to download a package. The tree command will let you see a graphical directory tree and is available via Homebrew.

Install tree with the brew install command.

$ brew install tree

Homebrew will update its list of packages and then download and install the tree command. Also, Homebrew installs files to /usr/local by default, so they won’t interfere with future macOS updates. Verify the installation of tree by displaying the command’s location with the which command:

$ which tree

The output shows that the tree is located in /usr/local/bin:


Also, you can run the tree command to see the version.

tree --version

Then to upgrade the version, run the below command.

$ brew upgrade tree

In case, if you wish to remove the package from the server then run the below command.

$ brew uninstall tree


5. Install Desktop Applications

Homebrew Cask lets you install desktop applications. To use Homebrew to install Visual Studio Code, run the following command.

$ brew cask install visual-studio-code

Then to remove it, run the below command.

$ brew cask uninstall visual-studio-code


6. Uninstalling Homebrew from mac

In case, if you don’t need the Homebrew anymore then you can use its uninstall script.

First, download the uninstall script with curl.

$ curl -fsSL -o

Then review the contents of the script by running the below command.

$ less

After verifying the script, execute the script by running the below command.

$ bash --help

A list of options displays on the screen.

For instance, you can run the below command to see what the script will do.

$ bash -d

As a result, the script will list everything it will delete.

Once you are ready to remove everything, then run the below command to uninstall Homebrew.

$ bash

This will remove Homebrew and any programs you’ve installed with it.

[Need any further assistance with Mac queries? – We are here to help you.]



In today’s writeup, we saw how our Support Engineers install Homebrew on Mac.


Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.


var google_conversion_label = “owonCMyG5nEQ0aD71QM”;


Source link


Write A Comment