A better and healthier launchctl. Start your agents and go to lunch!
lc aims to be that friendly tool by wrapping launchctl and providing a few simple operations that you perform all the time:
ls [pattern]— List installed agentsstart [pattern]— Start an agentstop [pattern]— Stop an agentrestart [pattern]— Restart an agentstatus [pattern]— Show agent status (PID, label)install [file]— Install a plist fileuninstall [pattern]— Uninstall an agentshow [pattern]— Display plist contentsedit [pattern]— Edit plist in your $EDITOR
Where pattern is just a substring that matches the agent's plist filename. If you don't use a unique pattern, lc will warn you and give you a list of the matching items instead.
So instead of:
launchctl load ~/Library/LaunchAgents/io.redis.redis-server.plistyou can do this:
lc start redisand:
$ lc ls
com.danga.memcached
com.google.keystone.agent
com.mysql.mysqld
io.redis.redis-server
org.mongodb.mongodcargo install --path .cargo build --release
# Binary will be at target/release/lclc <COMMAND> [OPTIONS] [PATTERN]
Commands:
ls Show the list of installed agents
list Alias for 'ls'
start Start the first agent matching pattern
stop Stop the first agent matching pattern
restart Stop and start the first agent matching pattern
status Show the PID and label for agents
install Install a plist file to LaunchAgents
uninstall Uninstall an agent
rm Alias for 'uninstall'
show Show the contents of a plist file
edit Open the plist file in $EDITOR
help Print help for a command| Flag | Long | Description |
|---|---|---|
-l |
--long |
Display absolute paths when listing agents |
-x |
--exact |
Force exact (case insensitive) match |
-w |
--write |
Persist the start/stop command |
-F |
--force |
Force start disabled agents |
-v |
--verbose |
Show command executions |
-s |
--symlink |
Use a symlink for installation |
-p |
--pretty |
Pretty print plist as KDL format (show command) |
-r |
--raw |
Output raw text without syntax highlighting (show command) |
# List all agents
lc ls
# List agents with full paths
lc ls -l
# List agents matching a pattern
lc ls redis
# Start an agent (persists across reboots with -w)
lc start -w redis
# Stop an agent
lc stop mongo
# Check status of agents
lc status mysql
# Install a plist file
lc install /usr/local/Cellar/redis/2.2.2/io.redis.redis-server.plist
# Install using a symlink
lc install -s /path/to/my.plist
# Show plist contents (with syntax highlighting if bat is installed)
lc show redis
# Show plist as KDL format
lc show --pretty redis
# Show plist without syntax highlighting
lc show --raw redis
# Edit a plist in your editor
lc edit mongo
# Uninstall with exact match (won't match elasticsearch14)
lc uninstall -x elasticsearchThe show command automatically pipes output through bat for syntax highlighting when:
batis installed and available in PATH- Output is going to a terminal (not piped or redirected)
- The
--rawflag is not specified
If bat is not installed, output is displayed as plain text.
If you run lc as root, you can also manage daemons in:
/Library/LaunchDaemons/System/Library/LaunchDaemons
cargo testcargo clippycargo build # Debug build
cargo build --release # Release buildlc was originally written in Ruby by Mike Perham under the name "lunchy". This version is a complete rewrite in Rust, maintaining the same interface and functionality while providing a single static binary with no runtime dependencies.
The original name was supposed to be "launchy". Lunchy isn't a great name but gem names are like domains, most of the good ones are taken. :-)
Thanks to all the individual contributors who've improved lc over the years.
- Mike Perham @mperham — Original author
- Eddie Zaneski @eddiezane
- Mr Rogers @bunnymatic
- and more
MIT