Launch Services is a core service of the Mac OS that enables an actively running application to open other apps, documents, or URLs (Uniform Resource Locators). Launch Services is also used to prioritize which app is used to open a document or URL.
Launch Services replaced a number of earlier system managers the Mac used to use, such as the Desktop Manager, Internet Config, and File Manager, replacing them with the single Launch Services system, and the database Launch Services maintains to keep track of all things related to how documents and apps relate to each other.
Launch Services allows an app or document to:
- Open (launch or activate) another app.
- Open a document or URL.
- Identify the preferred app to use to open a document or URL.
- Register the type of documents or URLs an app is capable of working with.
- Keep track of information needed for displaying a file or URL, including its icon, name, and kind (examples: JPEG, PDF, Folder, Volume).
In past versions of the Mac OS, this type of information was maintained by the Finder, as well as by some specific system managers. By consolidating this information to the Launch Services, it allows for greater reliability, easier (actually, automatic) registration of file and document associations, and less need to repair file association information. If you remember having to rebuild the Desktop frequently on older Macs, then you know the file associations tended to get out of whack often.
Launch Services maintains a database aptly known as the Launch Services Database, which is used to record all the needed information about apps, documents, and URLs to determine which items an app is capable of working with.
Application Registration
Launch Services automatically registers an app with the database the first time the app becomes known to the system. This can occur when:
- The Finder reports an app has been added to the Applications folder.
- An app installer is run.
- When a document is opened that has no preferred app, the user is asked to select an app to use, and that app is registered with Launch Services.
- When the built-in Launch Services tool is run whenever you boot your Mac or login as a user. This tool scans the Applications folder looking for any new apps that have been placed there.
Opening Documents
When you open a document or URL, Launch Services is used to determine which app to use to open the item. Launch Services uses the following specific order to check for which app to use:
User-Specified Binding: If the user has set a specific binding by manually setting a file association, then use that app to open the document or URL. Do not check further. Note: You can manually set file associations using one of the tips in: Quick Tip: Managing macOS File Associations or macOS 101: Six “Forgotten” Tips for New (and Old) Mac Users.
If the document has a file name extension, Launch Services will find all apps that list the extension as compatible.
If the document has a four-character file type, Launch Services finds all apps that accept the file type.
If more than one app is found, the following is used to determine a preference:
If the document has a four-character creator type that matches an app:
Give preference to apps on the boot volume.
Give preferences to apps residing on local volumes vs. ones on remote volumes.
If two or more files and an app still meet the criteria, give preference to the newest version.
What Could Go Wrong?
For the most part, Launch Services and its database provide a robust and reliable service for managing app and document associations. But as we all know, sometimes things can go wrong. Some of the most common problems encountered include:
- Wrong document icon: The most common form this problem takes is a document file having a generic icon when it should have an icon associated with the app that was used to create it. Other possible icon issues include a document having an icon from another app, and not the one you used to create it.
- Recent Items menu or Recent Items Dock stacks being incorrect: The Recent Items listing isn’t showing the correct app or doc, or isn’t being updated when you open an app or doc.
- Open With menu: If the Finder’s File, Open With menu or the contextual (right-click a file icon) Open With menu is displaying duplicate entries, or one or more apps are being listed that should not be used to open the document type.
- Wrong app associated with a document: This is similar to the Open With problem listed above, but in this case, the problem occurs because an app you used to use has been removed from your Mac, and the Launch Services database, for an unknown reason, wasn’t correctly updated.
Rebuilding Launch Services Database
Any of the above issues can usually be fixed by rebuilding the Launch Services database. You’ll find instructions for two different methods of rebuilding the database in the Rocket Yard guide: Quick Tip: Managing macOS File Associations.
If you’re running into an issue where an app continues to show up as either the default or a recommended app in the Open With menu, but the app isn’t one that should be used to open the document type, or is one you don’t wish to ever use, you can manually remove that app’s association with the document and prevent it from ever appearing in the Open With list again.
Remove a Single App from the Open With Menu
The technique to remove a single app from the Open With list requires you to edit the app’s Info.plist file and rebuild the Launch Services Database. Essentially, you’re removing a file extension type that the app in question knows how to work with. By eliminating the extension type from the app’s Info.plist, you make the app blind to the removed file type.
One common reason for doing this is to prevent an app from opening to edit or view a specific file type. For instance, you may normally use Photoshop to work with most graphics file types, but you prefer a different app for viewing PDF files.
Normally, you would use the option to create a User-Specified binding, as outlined above, to make sure those PDF image files are opened in your preferred app. But creating a User-Specified binding won’t keep the original app from being included in the Open With menu. If an app showing up in the Open With menu is really an issue for you, you can remove it using the following technique.
Before you attempt this method, make sure you have a current backup. You’re going to be making changes to an app, changes that can affect how the app in question works. If something should go wrong, you’ll want to be able to restore the app from a backup.
Using the Finder, browse to the app you wish to keep out of the Open With menu.
Right-click the app, and select Show Package Contents.
Open the Contents folder.
Right-click the Info.plist file, and select Duplicate from the popup menu.
This will create a file named Info copy.plist. This copy contains the data from the original Info.plist file. You can use this file to restore the Info.plist file to its original state should you ever need to. This step is just a precaution.
Right-click the Info.plist file, and select Open With from the popup menu.
You can open the Info.plist file with just about any text editor, including TextEdit, but I recommend using a text editor such as BBEdit, which knows how to format property list files for easier readability.
Using the text editor’s search function, locate the CFBundleTypeExtensions key.
There can be multiple CFBundleTypeExtensions keys in the Info.plist file; look for the one that incudes the following entry, just after the CFBundleTypeExtension key: <string>pdf</string>.
Once you locate the extension suffix you wish to remove, use the text editor to delete the entire line that says: <string>pdf</string> (in this example).
Save the edited Info.plist file.
Use the linked instructions, above, to rebuild the Launch Services database.
Rebuilding Launch Services on Older Versions of the Mac OS
Launch Services has undergone a few changes over the years since it was first made available. If you’re using an older version of OS X, you may have seen error messages when you tried to rebuild the Launch Services database. Here are the instructions to perform a rebuild for earlier versions of OS X:
OS X Jaguar (10.2)
Quit all apps.
Delete the com.apple.LaunchServices.plist file located at ~/Library/Preferences.
Delete the com.apple.LaunchServices.UserCache.csstore file located at ~/Library/Caches.
Restart your Mac.
OS X Panther (10.3)
Follow the instructions for OS X Jaguar and include the following item in the list of files to be deleted:
com.apple.LaunchServices.6B.csstore located at /Library/Cache.
OS X Tiger (10.4)
Follow the instructions for OS X Jaguar, and include the following items in the list of files to be deleted:
com.apple.LaunchServices-0140.csstore
com.apple.LaunchServices-014xxx.csstore. The xxx is a stand in for a UID (User ID) number that is unique to you.
The above files are located at /Library/Cache.
OS X Leopard (10.5) and Snow Leopard (10.6)
Use the following Terminal command in place of the one mentioned in the linked article under the Rebuilding Launch Services Database section, above:
find /System/Library/Frameworks -type f -name “lsregister” -exec {} -kill -seed -r \;
OS X Lion (10.7) and later
Use the Terminal command as directed in the linked article.
If you run into any problems we haven’t covered, or discover a new tip, please share the info in the comments section, below.
How do you kill and restart launch services?
killall
Why? I use an app that is very possessive. It changes the “owner” of certain file types simply by opening the app. I keep a copy of the database file elsewhere. After using the app, I copy the database file where it belongs. Unfortunately, I have to restart for launch services recognizes my database. I have no idea what the possessive app does, but I would like to be able to do it too but with the original application to file extension mapping.