Homebrew is a package managing tool. It’s more popular on Linux but is also used extensively on macOS. In fact, for apps that install as packages, Homebrew is the easiest way to remove them. Here’s how you can install Homebrew on macOS Catalina.
Xcode
In order to install Homebrew on macOS Catalina, you must have Xcode installed. You can get it from the Mac App Store. The app is large and for some reason, it downloads really slow when you get it from the Mac App store so you’re in for a little wait.
Step 4 — Installing, Upgrading, and Removing Packages. Now that Homebrew is installed, use it to download a package. The tree command lets you see a graphical directory tree and is available via Homebrew. Install tree with the brew install command: brew install tree. Make sure to check out Part One, How To Install Apache on macOS 10.15 Catalina Using Homebrew, which is a pre-requisite for this piece. In the past, I used to rely on the version of Apache and PHP that came pre-loaded with the OS on my MacBook Pro. I would then install the PHP extensions I needed (Xdebug, Redis, etc.) from Homebrew. ShawnstationdeMacBook-Pro: shawnstation$ brew -version Homebrew 1.6.9 Homebrew/homebrew-core (git revision fab7d; last commit 2018-07-07) catalina homebrew Share. Homebrew is a package managing tool. It’s more popular on Linux but is also used extensively on macOS. In fact, for apps that install as packages, Homebrew is the easiest way to remove them. Here’s how you can install Homebrew on macOS Catalina. In order to install Homebrew on macOS Catalina, you must have Xcode installed. Brew Macos Catalina Additionally, SUMO provides native macOS application bundles for its graphical applications, so they can be added to the macOS dock. There is a separate brew cask that will copy these bundles to the Applications folder: brew cask install sumo-gui.
Once it’s installed, you also need to install Command Line tools for it. To install Command Line tools, open Terminal and enter the following command.
You will see a prompt asking you to confirm that you want to install the tools, and you will also see an EULA that you have to agree to.
The Command Line tools don’t take too long to install. Once it’s finished you can install Homebrew.
Install Homebrew
Open Terminal and run the following command.
You will have to confirm that you want to install Homebrew. The Terminal will show you all the changes it will be making i.e., new directories it will make when it is installed. Confirm that you want to install it.
After that, you only have to wait for the installation to complete. Once it is complete, you will see a message in Terminal confirming that installation was successful. You can now close Terminal.
If at any point you want to verify the Homebrew installation, you can run the following command in Terminal.
The command will return which version of Homebrew is installed on your Mac.
If you want to uninstall Homebrew, you can run the following command in Terminal.
Homebrew has tons of documentation available so if you’re not sure how to use it, go through the documentation. Apps that you can install via Homebrew often provide the command that you need to run to install them. They basically come with a script that can be run via Homebrew and the script takes care of the installation. If there’s an uninstall script available, you can run it to remove the app.
You should know that apps you install via Homebrew still have to be 64-bit if you’re installing them on Catalina. Homebrew doesn’t let users by-pass the 64-bit condition that Catalina has. There is no getting around that. On that note, Homebrew had to update to a Catalina compatible version so it’s unlikely that you will be able to install older versions of it.
14th Feb 2020I had to reconfigure my Macbook after sending it for repairs. During the reconfiguration period, I noticed the instructions I linked to in “Setting up a local MongoDB connection” were outdated.
Here’s an updated version on how to install MongoDB on a Mac.
There are a few steps:
First, you install Homebrew. If you’re curious about what Homebrew is, read this article.
Second, find the MongoDB tap.
Third, install MongoDB.
MongoDB is now installed on your computer.
Preparations (Before MacOS Catalina)
Before you can use MongoDB, you need to create a /data/db
folder on your computer to use MongoDB. You can create this folder with the following command:
You also need to give permissions to use it:
Now you can follow the rest of the article to set up your MongoDB connection.
Preparations (MacOS Catalina onwards)
Apple created a new Volume in Catalina for security purposes. If you’re on Catalina, you need to create the /data/db
folder in System/Volumes/Data
.
Use this command:
Then, use this command to give permissions:
Using MongoDB
In the past, I can run the mongod
command to start MongoDB. This no longer works out for the box from MongoDB v4.2.3 onwards.
The best way to start MongoDB now is via brew services
.
Starting MongoDB
Use this command:
MongoDB will start as a background service. Here’s what you’ll see:
How To Install Brew On Catalina
You can use start
instead of run
. start
will start MongoDB automatically when you login into your Macbook. I prefer run
since I don’t want MongoDB to be running all the time.
Checking if MongoDB is running
Use this command:
How To Install Brew On Macos Catalina
Homebrew will list all running services. If MongoDB is running, mongodb-community
will have a status set to started
.
The Mongo Shell
If MongoDB is running, you should be able to access the Mongo shell with the mongo
command.
Stopping MongoDB
Use this command:
Homebrew will stop MongoDB and let you know.
Aliases to make these easier
It’s a chore typing brew services run mongodb-community
every time I want to start MongoDB.
I created some aliases to make things easier for me. Here are my aliases:
What’s next?
If you haven’t already, you should learn how to set up a local MongoDB connection.
If you enjoyed this article, please tell a friend about it! Share it on Twitter. If you spot a typo, I’d appreciate if you can correct it on GitHub. Thank you!