Sunday, October 16, 2022

How to change web browser via Terminal on macOS?


Step 1. Install Homebrew

Homebrew is an essential package for Mac users. Homebrew allows us to install the latest and updated version of popular applications, packages, and developer tools.

Here is a link to how to install Homebrew on macOS.

Step 2. Install defbro

Install defbro via the following brew command.

macOS:/Users/analysisman% brew install jwbargsten/misc/defbro

Running `brew update --auto-update`...
==> Auto-updated Homebrew!
Updated 2 taps (homebrew/core and homebrew/cask).
==> New Formulae
autocorrect                  fonts-encodings              iir1                         ...snipped...

==> Tapping jwbargsten/misc
Cloning into '/opt/homebrew/Library/Taps/jwbargsten/homebrew-misc'...
remote: Enumerating objects: 23, done.
remote: Counting objects: 100% (23/23), done.
remote: Compressing objects: 100% (16/16), done.
remote: Total 23 (delta 3), reused 20 (delta 3), pack-reused 0
Receiving objects: 100% (23/23), 4.70 KiB | 4.70 MiB/s, done.
Resolving deltas: 100% (3/3), done.
Tapped 1 formula (16 files, 14.2KB).
==> Downloading https://github.com/jwbargsten/defbro/archive/refs/tags/v0.0.1.tar.gz
==> Downloading from https://codeload.github.com/jwbargsten/defbro/tar.gz/refs/tags/v0.0.1
##O#-#
==> Installing defbro from jwbargsten/misc
==> swift build --disable-sandbox --configuration release
🍺  /opt/homebrew/Cellar/defbro/0.0.1: 5 files, 1.4MB, built in 42 seconds
==> Running `brew cleanup defbro`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
==> `brew cleanup` has not been run in the last 30 days, running now...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
Removing: /Users/analysisman/Library/Caches/Homebrew/ca-certificates--2022-07-19 (125.8KB)
Removing: /Users/analysisman/Library/Caches/Homebrew/gettext--patch--35abc93c.diff... (960B)
Removing: /Users/analysisman/Library/Caches/Homebrew/gettext--0.21.tar.gz... (23MB)
Removing: /Users/analysisman/Library/Caches/Homebrew/glib--2.72.3... (6.3MB)
Removing: /Users/analysisman/Library/Caches/Homebrew/gnutls--3.7.7... (3.0MB)
Removing: /Users/analysisman/Library/Logs/Homebrew/jansson... (64B)
Removing: /Users/analysisman/Library/Logs/Homebrew/mtr... (64B)

Step 3. Check your current default web browser

macOS:/Users/analysisman% defbro
  org.torproject.torbrowser (Tor Browser)
  org.mozilla.firefox (Firefox)
  company.thebrowser.Browser (Arc)
  com.parallels.winapp.a5c41f715c1b8a880253846c025624e9.a0d8d48a6b0c5d (Microsoft Edge)
  com.parallels.winapp.76868ae832f6c6bd26cadc7d7c269986.a0d8d4eaed9a5d (Google Chrome)
  com.parallels.desktop.console (Parallels Desktop)
  com.microsoft.edgemac (Microsoft Edge)
  com.microsoft.edgemac (Microsoft Edge)
  com.microsoft.edgemac (Microsoft Edge)
  com.googlecode.iterm2 (iTerm2)
  com.google.Chrome (Google Chrome)
  com.browserosaurus (Browserosaurus)
  com.brave.Browser (Brave Browser)
* com.apple.Safari (Safari)
  com.TechSmith.Snagit2021 (Snagit 2021)

Step 4. Change your default web browser

macOS:/Users/analysisman% defbro com.google.Chrome
  org.torproject.torbrowser (Tor Browser)
  org.mozilla.firefox (Firefox)
  company.thebrowser.Browser (Arc)
  com.parallels.winapp.a5c41f715c1b8a880253846c025624e9.a0d8d4ec7d0c5d (Microsoft Edge)
  com.parallels.winapp.76868ae832f6c6bd26cadc7d7c269986.a0d8d4eae70c5d (Google Chrome)
  com.parallels.desktop.console (Parallels Desktop)
  com.microsoft.edgemac (Microsoft Edge)
  com.microsoft.edgemac (Microsoft Edge)
  com.microsoft.edgemac (Microsoft Edge)
  com.googlecode.iterm2 (iTerm2)
  com.google.Chrome (Google Chrome)
  com.browserosaurus (Browserosaurus)
  com.brave.Browser (Brave Browser)
* com.apple.Safari (Safari)
  com.TechSmith.Snagit2021 (Snagit 2021)
setting default browser to com.google.Chrome

References

macos - Set default web browser via command line? - Stack Overflow

Links

[[_Index_2_macOS]]


No comments: