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.get_default_browser()
print(f"Current default browser: {current}")
# List all available browsers
browsers = macdefaultbrowsy.get_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:
- Query all installed applications that can handle HTTP/HTTPS URLs
- Get the current default browser
- 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
- Check macdefaultbrowser for a similar tool written in Swift.
Release files for macdefaultbrowsy 2.2.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| macdefaultbrowsy-2.2.3.tar.gz | 6.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| macdefaultbrowsy-2.2.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 15.2 kB
Release files / macdefaultbrowsy-2.2.3.tar.gz
| Download URL | macdefaultbrowsy-2.2.3.tar.gz |
|---|---|
| Size | 6.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5a1d592b0930df0b63273747c2aea8976c1dcbb985f63d3715331475f69d71b1
|
|
BLAKE2b-256 checksum How to use checksums |
97acd0896c53d19f32103d674f5514c2ecb7e3ceefa53991b7b912980ed3734d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-httpx/0.28.1
|
Release files / macdefaultbrowsy-2.2.3-py3-none-any.whl
| Download URL | macdefaultbrowsy-2.2.3-py3-none-any.whl |
|---|---|
| Size | 8.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4cefe5587f92b5d2f82412ca3d5e8485b2a4f6f0e4976105eba6a247465c8b9e
|
|
BLAKE2b-256 checksum How to use checksums |
1691d89fda668c85385dff115a9b1b35fcecf99298f1dfce09fe0af7cab2d30a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-httpx/0.28.1
|