Setting your default browser via Command Line in macOS

letsbsocial1

Maria Campbell

Posted on August 19, 2024

Setting your default browser via Command Line in macOS

Photo by Designecologist on pexels.com

This post was originally published on my personal blog mariadcampbell.com.

Table of Contents

Installing the Homebrew package defaultbrowser

In order to set my default browser in macOS via Command Line, I first
had to install the Homebrew package called defaultbrowser.

First, I ran the following commands, one after the other:

brew update
brew upgrade
Enter fullscreen mode Exit fullscreen mode

This is similar to what we do in Linux Mint when we run
sudo apt update and sudo apt upgrade to make sure that all our
packages are up to date before installing a new one. We have to do
the same with Homebrew.

brew install defaultbrowser

Next, I run the following command to install the defaultbrowser
package:

brew install defaultbrowser
Enter fullscreen mode Exit fullscreen mode

Running the defaultbrowser safari command

After it was successfully installed, I quit the active Terminal window
and opened up a new instance. And there, I ran the following command to
make Safari my default browser:

defaultbrowser safari
Enter fullscreen mode Exit fullscreen mode

And that was it!

No more need to go into browser settings searching for the location
where to set a particular browser as your default browser. You can just
set it by typing a simple two word command in Terminal!

💖 💪 🙅 🚩
letsbsocial1
Maria Campbell

Posted on August 19, 2024

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related