The file extension .app means that it's a Mac OS Application, any folder can have .app appended, but only folders with the specified hierarchy will actually run as Mac OS Applications. It is recommended to keep these files in the Applications folder for a number of reasons, including the fact that some applications rely on the /Applications/Example App.app path, to prevent folders such as Downloads and Desktop becoming over-cluttered and to keep everything organised in a central location.
The .app extension is actually just a folder with a special hierarchy which makes up a Mac OS app "bundle". All "bundles" contain the following:
- Info.plist: A .plist file which contains most of the information about the Application, such as Name, what name to display in the Menu Bar, where the Application's icon resides (usually in the Resources sub-directory) and the name of the executable which must be run among other things.
- MacOS: This is where the actual execuatbles are placed. The executable named in the Info.plist has to reside here, otherwise Mac OS won't find it and the Application won't run. This folder also can contain other executables for different functions, add-ons for the program and Mac OS as well as drivers which may be needed for the program to work correctly.
- Resources: This folder contains anything from images such as the icon or specially designed buttons for the Application, to things like Licenses and special documents where information is stored. It also often contains .nib and .xib files where the UI (user-interface) of the program is loaded from (needs citations), files to provide localisation and often optional drivers or add-ons.
- (Optionally) Frameworks: Sometimes, if the developer has used something like the Qt framework, this folder might exist and house some of the neccisary files and libraries for the program to run. An example would be Qt.framework, which is also a type of Mac OS Bundle, but contains library files rather than an executable.