The app program is a PERL script which lists and runs OS X Applications
from the
command line.
The standard method of opening an application from
the command line is with the open command. However when opening an
application, you must give the absolute path name. For example to open
TextEdit.app you type this command:
open /Applications/TextEdit.app
The app program is a front-end to the open command which automatically searches for an application and finds the first match if an incomplete portion of an application name is found (case insensitive). Here is an equivalent command for opening TextEdit.app with the app program:
app text
To install the program, copy to any directory in your command path (/usr/bin always works, /usr/local/bin is better). Run the terminal command:
echo $PATH
to see the list of directories in the command search path. To copy to a directory in that list:
sudo cp app /usr/local/bin
To verify that the app program is installed correctly type "which app" which should replay with the location that to which copied the program:
which app /usr/local/bin/app
If the program cannot be found, you may need to allow the computer to run it as a program:
sudo chmod 0755 /usr/local/bin/app
You can also run the program from the current directory by prepending the string "./ to the command name:
./app
Option | Description |
---|---|
-f | display full paths of Applications. |
-l | list all Applications which are available |
-w regexp | list all Applications which string matches to. |
-p | display list in paragraph form. |
-d | deep search for apps |
- app
- Show a list of all Applications.
- app -l
- Same as "app" with no options.
- app string
- Run the first Application (sorted alphabetically) found which contains string. Example: "app finder".
- app ^string
- Run the first Application found which starts with "string".
- app -f
- Show list of Applications, including full pathnames.
- app -w ^t
- Show a list of Applications which start with the letter T.
- app -p
- Show list of all Applications in paragraph form.
- app -d
- Search entire file structure for directories ending in ".app".
When given only a single argument without options, the app command will search for the first application which contains that string. For example typing the command:
app text
Will open /Applications/TextEdit.app. If there are multiple applications containing the string "text" and you want to open the first one found which starts with that string, type:
app ^text
To type full application names with spaces, three methods are possible:
app dvd\ player app "dvd player" app dvd_player
Typing app
by itself or app -l
will alphabetically print a list of
all applications found in the search path.
app Activity Monitor Adobe Flash Player Install Manager AirPort Utility App Store AppleScript Editor Audio MIDI Setup Automator Bluetooth File Exchange Boot Camp Assistant ...
The -f option causes the full pathname of the applications to be shown in the listing. The list is then sorted alphabetically including the full path of the application.
app -f /Applications/App Store.app /Applications/Automator.app /Applications/Boxer.app /Applications/Calculator.app /Applications/Calendar.app /Applications/Chess.app /Applications/Contacts.app /Applications/Dashboard.app /Applications/Dictionary.app ...
The -p option can be used to list the applications in paragraph format. This is useful for viewing larger numbers of applications in a single window. Spaces in the application name are converted to underscores so that the start/stop of the application name is clear.
app -p Activity_Monitor Adobe_Flash_Player_Install_Manager AirPort_Utility App_Store AppleScript_Editor Audio_MIDI_Setup Automator Bluetooth_File_Exchange Boot_Camp_Assistant Calculator Calendar Chess ColorSync_Utility Console Contacts DVD_Player Dashboard Dictionary DigitalColor_Meter Disk_Utility FaceTime Fetch Firefox Font_Book GarageBand Google_Chrome Grab Image_Capture Inkscape Keychain_Access Launchpad MacVim Mail Messages Mission_Control Network_Utility Notes PDF_Converter_Free Photo_Booth Preview QuickTime_Player QuickTime_Player_7 RAID_Utility RealPlayer RealPlayer_Converter Reminders Remote_Desktop_Connection Safari Stickies System_Information System_Preferences Terminal TextEdit Time_Machine Toolkit VoiceOver_Utility X-COM_Demo XQuartz Xcode iMovie iPhoto iTunes
By default the app command will open the first application that matches to the argument. The -w</tt option can be used to list all matches to locate a secondary match. The following example list all applications which contain the string "te" (or "Te", "TE", "tE" since the case of the text is ignored).
app -w te DigitalColor Meter Game Center Notes PDF Converter Free Remote Desktop Connection System Information System Preferences Terminal TextEdit
To only search for matches at the start of a string prefix search with "^" (or "$" for the end of a string).
app -w ^te Terminal TextEdit
A variable at the top of the app program called @searchdirs contains a list of directories to search for applications. The main locations for applications in OS X is /Applications and /Applications/Utilities. The -d option can be used to search for all applications on the computer in any location in the directory structure. The deep search uses the locate command.
When no argument is given, the -d will cause a list of all found applications to be listed. For example the pre-defined search path for applications may find about 100 applications:
app | wc -l 85
Doing a deep search will find many more:
app -d | wc -l 468
The -d option can be used to open an application not found in the standard search path:
app -d some_exotic_app