It’s time for an adventure in app bundle identification!
As a Mac admin there are times where you need to find the Bundle ID of a macOS or iOS application. This might be for an app config, if you’re blocking an app by its bundleid (oftentimes more reliable using a file path), or if you’re configuring PPPC Profiles for an application..
Finding macOS App Bundle IDs
Method 1 – Using Terminal
Finding an app’s Bundle ID on the mac is pretty straight forward. All you have to do is open Terminal and enter the following command:
codesign -dr - /path/to/yourapp.app
Pro Tip: You can drag and drop your app into Terminal right after the codesign -dr – to get the full path of the application.
It will spit out both the certificate leaf and the Bundle ID. I mention this method first because usually when admins are trying to look up a Bundle ID it’s for creating a PPPC Profile, and that usually requires the certificate leaf as well.
In the example output below I can see the Bundle ID for Brave Browser is com.brave.Browser
Everything past the designated =>
will be your certificate leaf which you’ll need if you’re building a PPPC (Preferences Policy Control) Profile.
$ codesign -dr - "/Applications/Brave Browser.app"
Executable=/System/Volumes/Data/Applications/Brave Browser.app/Contents/MacOS/Brave Browser
designated => identifier "com.brave.Browser" and anchor apple generic and certificate 1[field.1.2.840.113635.100.6.2.6] /* exists */
Method 2 – Info.plist
You can also find an app’s Bundle ID by inspecting its package contents. Right-click on the app you want to retrieve the bundle ID for and choose Show Package Contents.
Inside the Contents folder is an Info.plist. This will contain a CFBundleIdentifier
key containing the Bundle ID in its key value.
If you want to script the identification of a Bundle ID, you can also read the CFBundleIdentifier
key value pair with a piece of code using something like PlistBiddy or other tools that can read plists:
$ /usr/libexec/PlistBuddy -c 'Print CFBundleIdentifier' "/Applications/Brave Browser.app/Contents/Info.plist"
com.brave.Browser
Finding iOS App Bundle IDs
What about iOS/iPadOS/tvOS Apps though? Finding the bundle ids for those doesn’t have to be hard. The easy way is to use one of the following websites:
https://offcornerdev.com/bundleid.html
http://appsearch.co/
If you can’t find what you’re looking for using the above options, you may have to look for the Bundle ID yourself. Navjot Virk has a great post on how to find a bundle ID of an iOS app.