https://github.com/pekingduck/launchctl-el.git
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:
el
(require 'launchctl)
Do 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.
g
refreshRefresh the buffer.
q
quit windowt
sort listSort the buffer by service name.
n
create a new service configuration fileYou'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))
e
edit configuration file.v
view configuration file in read-only mode.l
load serviceEquivalent to
bash$ launchctl load <service-configuration-file>
u
unload serviceEquivalent to
bash$ launchctl unload <service-configuration-file>
r
reload serviceUnload and then reload.
d
disable service permanentlyOnce a service has been disabled, you won't be able to start or load it.
Equivalent to
bash$ launchctl unload -w <service-configuration-file>
p
enable service permanentlyTo start or load a disabled service, you must enable it first.
Equivalent to:
bash$ launchctl load -w <service-configuration-file>
s
start serviceEquivalent to
bash$ launchctl start <service-name>
o
stop serviceEquivalent to
bash$ launchctl stop <service-name>
a
restart serviceStop and then start the service.
m
remove serviceEquivalent to
bash$ launchctl remove <service-name>
i
display service infoDisplay service info
Equivalent to:
bash$ launchctl list <service-name>
*
filter by regexYou 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 variableSet an environment variable. You will be prompted for the variable name and its
value (separated by space), e.g. SOME_VAR "SOME VALUE"
.
Equivalent to:
bash$ launchctl setenv SOME_VAR "SOME_VALUE"
#
unset environment variableUnset an environment variable. You will be prompted for the variable name.
Equivalent to:
bash$ launchctl unsetenv SOME_VAR
h
display help messageDisplay a help message in the mini-buffer.
You can M-x customize-group
(group name: launchctl
) to
customize launchctl.
launchctl-search-path
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")
launchctl-configuration-template
When you choose to create (n
) a new configuration file, the corresponding
file buffer will be populated by this template.
launchctl-filter-regex
This regular expression will be used by launchctl to filter results . An
empty string (default) or .
means no filtering will be done.
launchctl-name-face
Customize the appearance of the Name column.
launchctl-name-width
, launchctl-pid-width
, launchctl-status-width
Customize the widths of the columns
launchctl-use-header-line
Turn the header line on or off.