Simple scripts to set default mail and browser applications on macOS.
Pre-compiled executables work on any macOS device without requiring developer tools.
- Download the pre-compiled binaries from the releases section
- Make them executable if needed:
chmod +x bin/SetDefaultApp./bin/SetDefaultApp [option] [app]Options:
browser- Set default web browsermail- Set default mail application
Examples:
./bin/SetDefaultApp browser chrome
./bin/SetDefaultApp mail outlookIf you prefer the separate executables, they are still available:
Setting Default Mail App:
./bin/SetDefaultMailApp [mail-app]Setting Default Browser:
./bin/SetDefaultBrowser [browser]Supported browsers:
safari- Safarichrome- Google Chromefirefox- Firefoxedge- Microsoft Edge
Supported mail apps:
mail- Apple Mailoutlook- Microsoft Outlook
- Xcode Command Line Tools installed
- Clone or download the Swift scripts
- Make them executable:
chmod +x SetDefaultApp.swift./SetDefaultApp.swift browser chrome
./SetDefaultApp.swift mail outlookIf you have the developer tools and want to distribute binaries to users without them:
- Make the compile script executable:
chmod +x compile.sh- Run the compile script:
./compile.sh- Distribute the executables from the
bindirectory
These scripts use system automation to handle prompts. Terminal.app needs accessibility permissions:
- Go to System Settings > Privacy & Security > Accessibility
- Click the '+' button
- Navigate to and select Terminal.app
- Enable the permission
- Pre-compiled executables work without developer tools
- The scripts will automatically handle system prompts if Terminal has proper permissions
- Mail.app is searched for in
/System/Applications - Third-party apps are searched in
/Applicationsand~/Applications