Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I don't really understand the difference. I tried putting a .app file in /usr/bin and executing if from the terminal but that doesn't do anything. What kind of files go in there?

share|improve this question

4 Answers 4

up vote 6 down vote accepted

Wikipedia has a good article on Application Bundles.

In short, a .app is not a file: it's a directory tree with a specific structure. The actual binary that runs (ie, the equivalent of the binary you'd find in /usr/bin) is PackageName.app/Contents/MacOS/PackageName. However, you (generally) can't just copy that file to '/usr/bin' and run it, because it will expect to have lots of other files it needs inside the .app folder as well - for instance, many applications have the translation files that allow them to present the UI in different languages under PackageName.app/Contents/Resources/de.lproj (where de happens to mean german).

In some cases, the .app bundle may contain executables you can execute directly - for instance, I often use the ebook-convert binary from the calibre.app bundle, by running /Applications/calibre.app/Contents/Resources/loaders/ebook-convert. In this case, ebook-convert happens to be a self-contained python script and is perfectly happy being called this way - not all executables will be as happy.

You can usually start a .app by calling the main binary directly - eg, /Applications/Safari.app/Contents/MacOS/Safari will launch Safari. However, this is a lot of typing - open /Applications/Safari.app is a shortcut that does the same thing.

man open has many more examples of using open to act as though the user had double-clicked on an icon in finder.

share|improve this answer
    
Just a note to add here. In the Finder you can see what's inside an Application Bundle (or any bundle) by right clicking on its icon and selecting "Show Package Contents" from the context menu. –  Josh Feb 27 '10 at 16:11

As Tomas Markauskas said, the .app is a bundle.

Why did you try to move a .app file to /usr/bin? I'm going to guess that what you really want to know is "how do I open a file using Foo.app when I'm at the command line?"

If I'm right, the answer isn't to move the .app file to /usr/bin. The right answer is to use the open command:

$ open -a Foo some_file

Using open without the -a will open the file with its default application -- just as if you double-clicked on some_file in the Finder.

share|improve this answer

.app is actually not a file, but a folder (or Application bundle) with many different files in it. It also contains the executable files that you actually run.

share|improve this answer

You can also run the app directly with the open command:

open /Applications/Safari.app/
share|improve this answer

Your Answer

 
discard

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