0

I would like to get the full path of OSX applications like Safari, Chrome, iTerm...

As I see, OSX packages have a specific folder structure, and so, the main binaries will end up in /Applications/*AppName*.app/Contents/MacOS/

For example: iTerm full path would be: /Applications/iTerm.app/Contents/MacOS/iTerm

Is this guaranteed for all applications, or is there a tool like "which" that can print the specific path?

2
  • 1
    It's pretty much guaranteed, but only down so far as /Contents/MacOS/ After that you can never be certain that the executable is always going to be exactly the same name as the package.
    – Tetsujin
    Jan 5, 2016 at 9:14
  • Thanks, I eventually ended up using: locate "/Applications*/Contents/MacOS*/iTerm"
    – codentary
    Jan 6, 2016 at 19:56

1 Answer 1

0

You are looking for the command "locate". The first time you use it, the system will have to generate a database, from that point on, you'll be good to go.

To set up the DB, run this:

sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist

Then, to run a locate (once the DB is created... it can take a while), run:

locate <search pattern>
1
  • Thanks @tomlester, as I mentioned above in comments, this is what I actually ended up doing: locate "/Applications*/Contents/MacOS*/AppName"
    – codentary
    Jan 6, 2016 at 22:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .