MacOS, differences between running a bundled app and running the bundle’s executable

applicationsmacosterminal

Can someone elaborate the differences in OSX between running a bundled application by doing one of the following:

  • double-clicking on it
  • search for it and run it from spotlight
  • open /Application/MyApp.app

or just running its executable in Terminal:

  • $ /Application/MyApp.app/Contents/MacOS/myapp (the executable binary)

Best Answer

In most cases there is no difference. However, inside every App bundle is an Info.plist file that contains information about the App that is useful (mainly) to Mac OS X (the types of files it handles, etc.).

But the Info.plist file can also contain information about the environment that the App needs to run in. For example, the Info.plist file can contain environment variables that need to be set before the executable is launched. If you launch the executable yourself (on the command line) then those variables won't be set and the behavior of the App might be different.

EDIT: To elaborate on this a little further, if you right-click on an App and "Show Package Contents", then drill down to "Contents:MacOS" and double-click the executable icon in that directory, you will also bypass launch services and information in the Info.plist file will be ignored. So you can do in the Finder what you are doing on the command line (without command-line options, of course).