Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lc

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 agents
  • start [pattern] — Start an agent
  • stop [pattern] — Stop an agent
  • restart [pattern] — Restart an agent
  • status [pattern] — Show agent status (PID, label)
  • install [file] — Install a plist file
  • uninstall [pattern] — Uninstall an agent
  • show [pattern] — Display plist contents
  • edit [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.plist

you can do this:

lc start redis

and:

$ lc ls
com.danga.memcached
com.google.keystone.agent
com.mysql.mysqld
io.redis.redis-server
org.mongodb.mongod

Installation

From Source (Cargo)

cargo install --path .

Building Manually

cargo build --release
# Binary will be at target/release/lc

Usage

lc <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

Options

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)

Examples

# 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 elasticsearch

Syntax Highlighting

The show command automatically pipes output through bat for syntax highlighting when:

  • bat is installed and available in PATH
  • Output is going to a terminal (not piped or redirected)
  • The --raw flag is not specified

If bat is not installed, output is displayed as plain text.

Root Access

If you run lc as root, you can also manage daemons in:

  • /Library/LaunchDaemons
  • /System/Library/LaunchDaemons

Development

Running Tests

cargo test

Linting

cargo clippy

Building

cargo build           # Debug build
cargo build --release # Release build

History

lc 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

Thanks to all the individual contributors who've improved lc over the years.

About

License

MIT

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages