Lets assume my current directory is /Applications
and it contains all my apps. Lets say I want to know the bundle identifier for Google Chrome:
$ mdls -raw -name kMDItemCFBundleIdentifier 'Google Chrome.app'
com.google.Chrome
Now let’s use that to locate the app:
$ mdfind kMDItemCFBundleIdentifier = com.google.Chrome
/Applications/Google Chrome.app
Now lets try the same for Tor Browser Bundle. First, get the bundle identifier:
$ mdls -raw -name kMDItemCFBundleIdentifier TorBrowser.app
org.mozilla.tor browser
Then, locate the app:
$ mdfind kMDItemCFBundleIdentifier = org.mozilla.tor browser
Nothing. I likely need to quote it:
$ mdfind kMDItemCFBundleIdentifier = 'org.mozilla.tor browser'
Nope, still nothing. Lets try something else:
$ mdfind kMDItemCFBundleIdentifier = 'org.mozilla.tor'
$ mdfind kMDItemCFBundleIdentifier = "org.mozilla.tor browser"
$ mdfind kMDItemCFBundleIdentifier = org.mozilla.tor\ browser
$ mdfind kMDItemCFBundleIdentifier = "org.mozilla.tor\ browser"
$ mdfind kMDItemCFBundleIdentifier = 'org.mozilla.tor%20browser'
$ mdfind kMDItemCFBundleIdentifier = 'org.mozilla.tor+browser'
$ mdfind kMDItemCFBundleIdentifier = 'org.mozilla.tor_browser'
Nothing works. This is the only app I ever had this issue with, and the only one I ever saw with a space in its bundle identifier. How can we reference it?
Best Answer
A proper bundle identifier should not have a space in it. According to Apple's App Distribution Guide -> About Bundle IDs, a
So, technically,
org.mozilla.tor browser
is not a valid bundle identifier, so you'll get unexpected results when trying to work with it. It should likely be changed (by the developer) to something likeorg.mozilla.tor.browser
ororg.mozilla.tor-browser
, etc.