Skip to main content

No project description provided

Project description

macdefaultbrowsy

A command-line tool and package (written in Python) for macOS that allows you to view installed browsers and set the default web browser, with automatic dialog confirmation.

Features

  • List all installed web browsers with the current default marked with *
  • Set any browser as the default with a simple command
  • Automatically confirms the system dialog (no manual clicking required)
  • Built as a universal binary (Intel + Apple Silicon)
  • Simple installation via Homebrew or manual install

Installation

uv pip install --system macdefaultbrowsy

or

pip install git+https://github.com/twardoch/macdefaultbrowsy

Usage

Command Line

List all browsers

macdefaultbrowsy

Output example:

  chrome
  firefox
* safari
  edge

Set default browser

macdefaultbrowsy chrome

The tool will automatically set Chrome as your default browser and confirm the system dialog.

Python API

from macdefaultbrowsy import macdefaultbrowsy

# Get the current default browser
current = macdefaultbrowsy.read_default_browser()
print(f"Current default browser: {current}")

# List all available browsers
browsers = macdefaultbrowsy.get_available_browsers()
print("Available browsers:")
for name in sorted(browsers.keys()):
    print(f"  {name}")

# Set a new default browser
success = macdefaultbrowsy.set_default_browser("chrome")
if success:
    print("Successfully set Chrome as default browser")
else:
    print("Failed to set default browser")

How it Works

The tool uses the macOS Launch Services API to:

  1. Query all installed applications that can handle HTTP/HTTPS URLs
  2. Get the current default browser
  3. Set a new default browser for both HTTP and HTTPS schemes

When setting a new default browser, the tool also uses AppleScript automation to automatically click the confirmation button in the system dialog, providing a seamless experience.

Development

To capture a snapshot of the codebase:

npx repomix -i ".giga,.cursorrules,.cursor,*.md" -o llms.txt .

License

This project is licensed under the MIT License - see the LICENSE file for details.

References

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

macdefaultbrowsy-2.0.5.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

macdefaultbrowsy-2.0.5-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file macdefaultbrowsy-2.0.5.tar.gz.

File metadata

  • Download URL: macdefaultbrowsy-2.0.5.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.28.1

File hashes

Hashes for macdefaultbrowsy-2.0.5.tar.gz
Algorithm Hash digest
SHA256 c033d75ac16908554dafac04c6f5f024e9648f6bf5fe6b056c09ffe2325cc255
MD5 8d048adfae2ef444fa494b70cfa02c13
BLAKE2b-256 e3cc70f673aa1f80dc8c1f4d4af0b1304ae953f1b7f922d13bbb3caacfd5b430

See more details on using hashes here.

File details

Details for the file macdefaultbrowsy-2.0.5-py3-none-any.whl.

File metadata

File hashes

Hashes for macdefaultbrowsy-2.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 c87ebc2eb156dccc6fc66f92e8e38b93939b16e7973c4989081fc36d3872fdd4
MD5 d9149e108e28ea1308d4d86ae1108774
BLAKE2b-256 7c2045c09552fc1d356336a9e91ebbe43eae14555b2cd7ba8d43920923cdf135

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page