MAC OS X - tahoe 26 - how to change default browser via defaultbrowser brew - console - 2026

Материал из Wiki - Iphoster - the best ever hosting and support. 2005 - 2026
Перейти к:навигация, поиск

Overview

defaultbrowser is a command-line utility for macOS that gets and sets the default browser (HTTP handler). Written in Objective-C, it uses the native Apple Launch Services API. Author — kerma, MIT license.

Works on all modern macOS releases including tahoe 26 (macOS 26), sequoia, sonoma, ventura, and Intel-based versions.

Installation

Via Homebrew:

brew install defaultbrowser

Build from source:

git clone https://github.com/kerma/defaultbrowser.git
cd defaultbrowser && make && make install

Usage

List all available HTTP handlers (current one is marked with *):

defaultbrowser

Sample output:

* safari
  chrome
  firefox
  edge

Set default browser:

defaultbrowser chrome
defaultbrowser firefox

How it works

The tool calls three macOS Launch Services functions:

  • LSCopyAllHandlersForURLScheme — list all apps registered for the http scheme
  • LSCopyDefaultHandlerForURLScheme — get current handler
  • LSSetDefaultHandlerForURLScheme — set a new handler

Source code: single Objective-C file.

Summary

brew install defaultbrowser && defaultbrowser firefox

Quickly switch your default browser from the terminal. Works on macOS from Catalina through tahoe 26.

Links

×
Реклама
ИКС