πŸ‘27views
Macbook: Change the default Mail Client using Terminal/CLI (Command Line Interface)

CloudScale SEO β€” AI Article Summary
What it isThis article explains how to use a Python script in Terminal to change your Mac's default email client by specifying the application's bundle identifier.
Why it mattersThis method is faster and more direct than navigating through System Preferences, especially useful for users who prefer command-line tools or need to automate the process.
Key takeawayYou can quickly change your Mac's default mail client using Terminal with a Python script and the target app's bundle identifier.

22

If you want to change the default mail client on your Mac then you can use a quick Python script to quickly change the default mail app. Copy/paste the following command into Terminal. Below I am setting Outlook to be the default mail client, but you can replace com.microsoft.Outlook with whatever application bundle identifier you use.

/usr/bin/python2.7 <<EOF
import LaunchServices;
result = LaunchServices.LSSetDefaultHandlerForURLScheme(
    "mailto",
    "com.microsoft.Outlook")
print("Result: %d (%s)" % (
    result,
    "Success" if result == 0 else "Error"))
EOF

Note: If you’re not sure what the bundle identifier is for your mail app is then simply run:

## Get the identifier for Apple Mail App
osascript -e 'id of app "Mail"'
com.apple.mail
## Get the identifier for Outlook App
/usr % osascript -e 'id of app "Outlook"'
com.microsoft.Outlook

One thought on “
πŸ‘27views
Macbook: Change the default Mail Client using Terminal/CLI (Command Line Interface)”

Leave a Reply

Your email address will not be published. Required fields are marked *