Switch, hide, show, quit, kill or list macOS applications from the command line or scripts.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


appswitch 1.1.3 [unreleased]

A command-line interface to the macOS process manager.

Written by Nicholas Riley <mailto:appswitch@sabi.net>.
Obtain updates from <https://sabi.net/nriley/software/>.


If you use shell scripts to automate macOS applications, you may need
to switch between applications.  You could use AppleScript via
osascript(1), but that can take several seconds for the script to
compile and execute - or you could use appswitch, which works almost

Say you're launching an X11 application from Terminal but the X server
isn't in front when you need it.  Use appswitch to fix the problem.

Or, if you'd like a version of the ps(1) utility which understands the
concept of macOS applications, appswitch can help.


The commands below install the 'appswitch' tool in /usr/local/bin,
which is in the default path.  You should subsequently be able to use
'appswitch' by typing its name.  If you wish to install it somewhere
else, modify the install line as appropriate.

% sudo /usr/bin/install -d -m 755 /usr/local /usr/local/bin
% sudo /usr/bin/install -d -m 755 /usr/local/share /usr/local/share/man
% sudo /usr/bin/install -d -m 755 /usr/local/share/man/man1
% sudo chmod 755 /usr/local/bin /usr/local/share/man /usr/local/share/man/man1
% sudo /usr/bin/install appswitch /usr/local/bin
% sudo /usr/bin/install -m 644 appswitch.1 /usr/local/share/man/man1
% rehash				# if necessary


% sudo rm -f /usr/local/bin/appswitch /usr/local/man/man1/appswitch.1


An Xcode project, 'appswitch.xcodeproj', is included.  A precompiled
binary is also provided.  'appswitch' was developed and tested under
macOS 10.13 with Xcode 9.0.


Just type 'appswitch' by itself to receive usage information.  See the
manual page (man appswitch) for more information.


Please send to the author, Nicholas Riley, at <appswitch@sabi.net>.


1.1.3 - unreleased
 - added -x option, without which XPC services are unlisted
1.1.2 - 1 August 2015
 - target the current (frontmost) application with -s, -h, -q, -k, -K,
   -P and -f if none of -c, -i, -p, -a or a path are specified
 - 64-bit Intel binary, built for OS X 10.8 and later (tested on 10.8.5,
   10.9.5 and 10.10.4)
1.1.1 - 12 May 2012
 - use Cocoa instead of CPS to show all/hide other applications
   (r. 4808397); required for compilation on OS X 10.7 and later
 - 32-bit/64-bit Intel binary, built for Mac OS X 10.6 and later
   (tested on 10.6.8 and 10.7.4)
1.1   - 6 November 2007
 - switched to Process Manager instead of CPS where possible - slower
   but more compatible (r. 4808397, 4808400)
 - fixed description of -k option: SIGTERM, not SIGINT
 - added -f option
 - fixed incorrect output/behavior with Mac OS X 10.5
 - Universal Binary, compatible with Intel Macs; built for OS X 10.4
   or later
1.0.1 - 16 May 2004
 - fixed crash matching applications with no bundle identifier
 - fixed process listing PSN column width
1.0   - 19 February 2003
 - added description of -q delay bug (no workaround)
1.0b3 - 13 February 2003
 - display spaces instead of ? characters when unprintable
 - properly handle very narrow window width with -l
 - further revised and clarified man page
 - added -q, -K, -L options
1.0b2 - 11 February 2003
 - display ? characters for unprintable creator code characters
   (e.g. java)
 - fixed -P/-p error in man page
 - revised and clarified man page
1.0b1 - 10 February 2003
 - added -S, -S, -h, -H, -k, -P, -l, -F options
 - fixed reference to bogus -u option
 - fixed bug where unknown match type was silently discarded
 - added man page and this README
1.0d1 - 4 February 2003
 - initial release