Posted on 11-16-2011 02:18 PM
Best practice to set the default open with application? I need to set all PDF's to open with Acrobat Pro. I don't see any MCX template for it. I know the preference is stored in com.apple.launchservices.plist.
Thanks in advance for any thoughts or help.
Wi11
Solved! Go to Solution.
Posted on 11-16-2011 03:03 PM
I use the following in Managed Preferences (using underscores to show indentation):
Display Name: Default applications
Description: Sets preferred applications.
Apply Setting To: User Level At Every Login
Domain: ~/Library/Preferences/com.apple.LaunchServices
Key: LSHandlers
Value:
<array>
<dict>
_____<key>LSHandlerContentType</key>
____<string>com.adobe.pdf</string>
____<key>LSHandlerRoleAll</key>
____<string>com.adobe.acrobat.pro</string>
</dict>
<dict>
____<key>LSHandlerContentTag</key>
____<string>pdf</string>
____<key>LSHandlerContentTagClass</key>
____<string>public.filename-extension</string>
____<key>LSHandlerRoleAll</key>
____<string>com.adobe.acrobat.pro</string>
_</dict>
</array>
This includes two examples. The first key is LSHandlerContentType, which assigns Acrobat Pro to open PDF files based on file type. The second key is LSHandlerContentTag, which assigns Acrobat Pro to open PDF files based on file extension. Use either or both. Shouldn't make a difference.
Posted on 11-16-2011 03:03 PM
I use the following in Managed Preferences (using underscores to show indentation):
Display Name: Default applications
Description: Sets preferred applications.
Apply Setting To: User Level At Every Login
Domain: ~/Library/Preferences/com.apple.LaunchServices
Key: LSHandlers
Value:
<array>
<dict>
_____<key>LSHandlerContentType</key>
____<string>com.adobe.pdf</string>
____<key>LSHandlerRoleAll</key>
____<string>com.adobe.acrobat.pro</string>
</dict>
<dict>
____<key>LSHandlerContentTag</key>
____<string>pdf</string>
____<key>LSHandlerContentTagClass</key>
____<string>public.filename-extension</string>
____<key>LSHandlerRoleAll</key>
____<string>com.adobe.acrobat.pro</string>
_</dict>
</array>
This includes two examples. The first key is LSHandlerContentType, which assigns Acrobat Pro to open PDF files based on file type. The second key is LSHandlerContentTag, which assigns Acrobat Pro to open PDF files based on file extension. Use either or both. Shouldn't make a difference.
Posted on 11-17-2011 11:55 AM
Talking moose, it was great meeting you at the JUNC, and thank you for the response! I also created one to set email to outlook.
Wi11
Posted on 11-17-2011 11:57 AM
You can also check out duti, which will allow you to associate certain file types with certain applications
Posted on 11-17-2011 12:16 PM
Talking moose, it was great meeting you at the JUNC, and thank you for the response! I also created one to set email to outlook.
Enjoyed meeting you as well and finally putting a face behind the Twitter account! Setting Outlook to be the default? Now, I don't even do that. ;-)
Posted on 11-17-2011 12:44 PM
We just rolled out a SharePoint site and Safari was sending email links to mail. It was confusing our users.
Posted on 08-06-2013 08:50 AM
Goal: To Make MS Outlook the default application for Mail, Contacts, and Calendars at imaging or first login. Seeing problems with changing the launchservices plist. I've created a script that adds the above components (all com.microsoft.outlook Handlers) to com.apple.launchservices.plist so that all pertinent file types roll to MS Outlook, making it the default. This script runs and successfully adds these pieces to the plist. Upon testing a generic .ics file, iCalendar continues to open. Mail shows that Outlook is the default app, but I've waited on changing this preference in Outlook. If this change is made, then all works well. Is there another plist that is getting changed? Or am I missing something with ownership/permissions modifications? Thanks...curious if anyone has a fix here.
Posted on 08-07-2013 05:55 AM
+1 for duti :)
Posted on 05-12-2015 11:18 AM
@Huber Did you ever get it working.
Default everything to MS Outlook on Imaging/ FIrst login.??
Can I see the script you used?
Posted on 04-28-2016 07:58 AM
@esantiago Check out: Setting Microsoft Outlook as the default application for email, contacts and calendars via Automator
derflounder #FTW
Posted on 07-11-2019 01:54 PM
@talkingmoose Raising the dead here - sorry. Do you know if this config can be applied at the computer level rather than the ~/user level?
Posted on 07-11-2019 03:22 PM
I wouldn’t try it anymore.
The reason it worked back then was because Jamf was using MCX Managed Preferences, which supported the Often option. It literally edited the current user’s plist file.
Today, if you try to do this with a configuration profile, these settings may work but anything you don’t explicitly include won’t work.
Looking to set Acrobat or something else? I’ve found a few useful scripts on here for managing those settings.
Posted on 07-12-2019 07:45 AM
Thanks William!
I am trying to set Fiji.app (a scientific app based on ImageJ) to open all .dv files (currently QuickTIme tries...and fails...and makes scientist sad and frustrated).
Our .dv files are not movie/video files per-se, they are 3-D z-axis "slices" of cells that are in the form of .dv and only Fiji.ap can open them.
I have been wrestling with Launch Services and haven't found a global way to set the file extensions .dv to open with Fiji yet (dev ID is org.fiji). And it looks like the duti utility is long in the tooth at thins point.
I already tried writing a KB article to teach scientists how to manually set the Fiji.app on a per-user basis (Get info > "Always Open With...") but they are still a little confused. I want to end this problem and blast-out a script/profile to set the app/file relationship and forget it!
Posted on 07-30-2019 02:22 AM
@dstranathan Have you had a look at "SwiftDefaultsApps" (https://github.com/Lord-Kamina/SwiftDefaultApps).
We pushed out the CLI and then set the default app via a command line policy.
Posted on 07-30-2019 04:47 PM
Nice - Ill check it out. A Pref Pane might be handy too. I ended up running a Python script (thanks to @pbowden).
Posted on 08-07-2019 06:06 AM
I'm looking to do the same. I've got 10 laptops that are distributed as loaners while machines are in for repair. The helpdesk is unhappy with having to set Acrobat Reader as the default app for all PDFs (I'm not sure why they can't just use Preview, but that's not my battle).
What has everyone used that works?
Posted on 08-07-2019 06:23 AM
@jbanks I'm happy with "SwiftDefaultsApps". We distributed the cli only (didn't want to add the system prefs) and then set the defautl app via policy or script. Advantage is that once it's there it's easy to do any additional changes.
https://github.com/Lord-Kamina/SwiftDefaultApps/releases
Posted on 09-05-2019 04:02 PM
Do you have any documentation or example script you use to set default apps? I don't see example commands on Github.
Thanks!
Posted on 09-05-2019 05:21 PM
I was just working with the SwiftDefaultApps command line a little bit ago, and this is what I found works for me. I'm looking to set the .pdf extension to open in Acrobat Reader instead of Acrobat Pro for our Mac Labs (since Adobe Pro folks would have to sign in). This command line seems to be working for me:
./swda setHandler --application /Applications/Adobe Acrobat Reader DC.app --UTI com.adobe.pdf
I haven't implemented a test in Jamf yet. Just thought I would pass along what I found what seems to be working for me. You can have the command line list the defaults for all extensions by typing this command:
./swda getUTIs
I found it helpful to install the preference pane on my system to help me sort out the terminology. I hope this helps you a little bit.
Posted on 09-06-2019 02:13 AM
Took me a while to figure this out but changing the filetype needs to be based on the correct attribute information.
I run this command first to determine the appropriate file attribute : mdls /path/to/file
This gives you the correct interpreter for the filetype you are trying to set.
Example for .csv: kMDItemContentType "public.comma-separated-values-text"
You then issue the command to swiftdefaultsapps cli (rolled out to /bin folder in this case) to set Excel to open csv files: /usr/local/bin/swda - setHandler --app /Applications/Microsoft Excel.app/ --UTI public.comma-separated-values-text
You can do a check on the current set apps by running this (swda cli in /bin): /usr/local/bin/swda - getUTIs
The variables for SwiftDefautlApps are:
- getHandler Returns the default application registered for the URI Scheme or <subtype> you specify.
- getApps Returns a list of all registered applications.
- getSchemes Returns a list of all known URI schemes, accompanied by their default handler.
- getUTIs Returns a list of all known UTIs, and their default handler.
- setHandler Sets <application> as the default handler for a given <type>/<subtype> combination.
- help Prints this help information
- version Prints the current version of this app
Hope this helps
T
Posted on 03-31-2020 11:51 AM
The app SWDA is working in command line " /usr/local/bin/SwiftDefaultApps/swda setHandler --app /Applications/IBM Notes.app --mail", but I cannot get it working with a launchAgent. Has anyone got this working?