Manually How to Set Outlook as Default Email Client on Mac OS X As everyone knows that changing the default email program is extremely confusing. Earlier time, there was a separate Control Panel folder for making all these settings. Hello To set Outlook as default open Apple Mail and go to preferences there will be a setting for default Mail. Set it it to Outlook. Another option: In Outlook go to Outlook> Preferences - General, click the Default application check box to Make Outlook the default application.
Not tested and copied from a source I can't remember were or from who, sorry. # Setting Outlook as default Mail app.
Thanks for the script. It did lead me in the right direction! During testing I found a few problems.
$username isn't set anywhere. For JAMF, this should be $3 2. There are 2 lines with extra 'com.apple.LaunchServices.plist' at the end. If you run the script (with username properly set) it will create an extra file which isn't used by anything and doesn't change anything. The add commands will all fail if the entries exist (which they most certainly will) I could have tested for the existence of each entry then acted accordingly, but since we just want to overwrite them anyway, it was simpler to delete,add each one. So, here is my script which has been tested on a few computers and successfully set Outlook 2016 to be the default mail app. (But I wouldn't call it thoroughly tested yet by any stretch.) Enjoy!
B #!/bin/bash # clear old LaunchServices # DO NOT USE. #/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -all local,system,user # Set plist path ($3 = username) plistPath='/Users/$3/Library/Preferences/com.apple.LaunchServices/com.apple.launchservices.secure.plist' # Delete the LSHandlers array # DO NOT USE. #/usr/libexec/plistbuddy -c 'delete:LSHandlers' '$plistPath' /dev/null 2&1 echo 'Setting Outlook as default Mail app.' # Delete the entries in case they already exist. Suppress errors if entries do not exist. Your script looks good and it's changing the plist as designed.
I rewrote it to scan for the most recently used email app and set that to the default. Problem is that launchServices doesn't appear to be reading this plist. It does save data there if I change via Apple's Mail preferences. I've done the lsregister -kill -r command to rebuild launchservices database, but it still won't read in the new setting - even after multiple reboots and threats of reformatting. If you come up with a way for the Mac to actually read this setting, I'd love to hear it. Yes - I'm running it on 10.12.
Haven't seen any issues. Please post errors to the github issues tracker and I'll take a look. Also, here's a python script to set outlook as the default mailto handler. Run it as the user with a LaunchA - don't run as a JSS script or you'll set the default email program for user 'root'. #!/usr/bin/python ##Import Launch Services framework from LaunchServices import. ##Set default application for 'mailto://' scheme LSSetDefaultHandlerForURLScheme('mailto', 'com.microsoft.Outlook'). I was able to get this working: #!/bin/bash userName=$(stat -f%Su /dev/console) pyscript=' ##Import Launch Services framework from LaunchServices import.
##Set default application for 'mailto://' scheme LSSetDefaultHandlerForURLScheme( 'mailto ', 'com.microsoft.Outlook ') ' sudo -u $userName -H python -c '$pyscript' Also, I manually changed the default mail client in the Mail.app preferences from Mail to Outlook, and when I did a compare of the com.apple.launchservices.secure.plist file before and after, only the mailto had changed. & - This is my script, building off yours. This will also set Outlook to handle emails, contacts and calendar files. Also, here's a python script to set outlook as the default mailto handler. Run it as the user with a LaunchA - don't run as a JSS script or you'll set the default email program for user 'root'. Original code: #!/usr/bin/python ##Import Launch Services framework from LaunchServices import.
##Set default application for 'mailto://' scheme LSSetDefaultHandlerForURLScheme('mailto', 'com.microsoft.Outlook') You can get around this with out having to run auser from launchctl I think I do not have outlook to test though. You could try this: modified code: #!/usr/bin/python from LaunchServices import. from SystemConfiguration import SCDynamicStoreCopyConsoleUser from Foundation import NSHomeDirectoryForUser currentuser, uid, gid = SCDynamicStoreCopyConsoleUser(None, None, None) homefolder = NSHomeDirectoryForUser(currentuser) domain = str('%s' + '/Library/Preferences/com.microsoft.Outlook')% (homefolder) LSSetDefaultHandlerForURLScheme('mailto', domain) Someone will have to test this though as I have no idea if this works, I don't use Outlook.