Skip to content

pekingduck/launchctl-el

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 

Repository files navigation

launchctl

Introduction

Screenshot

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.

Installation

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:

(require 'launchctl)

Usage

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.

Commands

g refresh

Refresh the buffer.

q quit window

t sort list

Sort the buffer by service name.

n create 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))

e edit configuration file.

v view configuration file in read-only mode.

l load service

Equivalent to

bash$ launchctl load <service-configuration-file>

u unload service

Equivalent to

bash$ launchctl unload <service-configuration-file>

r reload service

Unload and then reload.

d disable service permanently

Once 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 permanently

To start or load a disabled service, you must enable it first.

Equivalent to:

bash$ launchctl load -w <service-configuration-file>

s start service

Equivalent to

bash$ launchctl start <service-name>

o stop service

Equivalent to

bash$ launchctl stop <service-name>

a restart service

Stop and then start the service.

m remove service

Equivalent to

bash$ launchctl remove <service-name>

i display service info

Display service info

Equivalent to:

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".

Equivalent to:

bash$ launchctl setenv SOME_VAR "SOME_VALUE"

# unset environment variable

Unset an environment variable. You will be prompted for the variable name.

Equivalent to:

bash$ launchctl unsetenv SOME_VAR

h display help message

Display a help message in the mini-buffer.

Customization

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.

Reference

A launchd Tutorial

launchctl.plist(5) manpage

launchctl(1) manpage

launchd(8) manpage

About

An Emacs major mode for managing launchd jobs

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •