Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am looking for a way to find an app's location on the system from the command line using its bundle identifier. I can open it like this:

open -b 'com.zerotier.ZeroTierOne'

... where com.zerotier.ZeroTierOne is my bundle ID, but what I want to do is locate where the app is actually installed. I want a command that will return (for example):


in response to a query by identifier 'com.zerotier.ZeroTierOne'.

The "-R" option to open will reveal in finder but I want this to be completely non-interactive and done via a shell script.

share|improve this question

The magic command is:

mdfind kMDItemCFBundleIdentifier = "com.zerotier.ZeroTierOne"

You can determine this by working backwards from mdls foo | grep kMDItemCF

So if you didn't know iPhoto's CF Bundle Identifier:

Mac:~ me$ mdls /Applications/ | grep kMDItemCF
kMDItemCFBundleIdentifier           = ""
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.