git clone 'git://github.com/pekingduck/launchctl-el.git'
launchctl is a major mode in Emacs that eases the loading and unloading of services (user agents and system daemons) managed by launchd on Mac OS X.
launchctl interfaces with the command line tool
launchctl under the hood.
Launchctl is available from MELPA.
This package requires tabulated-list-mode which is only available for Emacs 24 and onwards.
If you install the package manually, put this in your dot emacs file:
M-x launchctl to enter launchctl mode.
Most commands are service-specific: you simply move the point to the corresponding service and execute that command.
Note that some commands (namely edit, load, unload, enable and disable) require
users to supply the path to the corresponding service configuration file
(.plist). launchctl will first look for <service-name>.plist
under the directories defined in
launchctl-search-path, and if the file
can't be found, prompt you for the path.
See Customization below on how to define your own search path.
Refresh the buffer.
Sort the buffer by service name.
ncreate a new service configuration file
You'll be prompted for a file name. See customization on how to customize the configuration template.
Put the code below in your .emacs to have Emacs recognize plist files as XML files:
(add-to-list 'auto-mode-alist '("\\.plist$" . nxml-mode))
eedit configuration file.
vview configuration file in read-only mode.
bash$ launchctl load <service-configuration-file>
bash$ launchctl unload <service-configuration-file>
Unload and then reload.
ddisable service permanently
Once a service has been disabled, you won't be able to start or load it.
bash$ launchctl unload -w <service-configuration-file>
penable service permanently
To start or load a disabled service, you must enable it first.
bash$ launchctl load -w <service-configuration-file>
bash$ launchctl start <service-name>
bash$ launchctl stop <service-name>
Stop and then start the service.
bash$ launchctl remove <service-name>
idisplay service info
Display service info
bash$ launchctl list <service-name>
*filter by regex
You will be prompted for a regular expression. Only services whose names match the expression will be shown. See Customization below on how to set a default value.
$set environment variable
Set an environment variable. You will be prompted for the variable name and its
value (separated by space), e.g.
SOME_VAR "SOME VALUE".
bash$ launchctl setenv SOME_VAR "SOME_VALUE"
#unset environment variable
Unset an environment variable. You will be prompted for the variable name.
bash$ launchctl unsetenv SOME_VAR
hdisplay help message
Display a help message in the mini-buffer.
M-x customize-group (group name:
The directories to look for service configuration files. The default value should be good for most people.
;;; Default ("~/Library/LaunchAgents" "/System/Library/LaunchAgents" "/System/Library/LaunchDaemons")
When you choose to create (
n) a new configuration file, the corresponding
file buffer will be populated by this template.
This regular expression will be used by launchctl to filter results . An
empty string (default) or
. means no filtering will be done.
Customize the appearance of the Name column.
Customize the widths of the columns
Turn the header line on or off.
A launchd Tutorial