DevelopmentUnreleased

This topic is not available in this guide. You're viewing its overview.

Development documentation may include features that are not in the latest release. Read the Lawn 0.8.1 guide.

Field guide

Overview

Control Lawn from the command line with the lawn CLI.

Use the CLI

The lawn CLI gives you full control over Lawn from the terminal.

Installation

Install the command line tool from CLI settings, then use it from Terminal.

You can also install (or reinstall) the CLI from the terminal if you already have access to the lawn binary:

lawn system cli install

To uninstall:

lawn system cli uninstall

Quick Start

# List available apps
lawn catalog search

# Install an app
lawn app install whoami

# See your installed apps
lawn app list

# Start and stop an app
lawn app start whoami
lawn app stop whoami

# View logs
lawn app logs whoami --follow

# Remove an app
lawn app remove whoami

Global Options

These flags are parsed globally. Output formatting depends on the command:

Option or variableDescription
--socket <path>Select a local engine Unix socket (auto-detected by default)
--server <host:port>Host and port to connect to; overrides LAWN_SERVER
LAWN_SERVERHost and port to connect to, in HOST:PORT form, when --server is absent
-o, --output <format>Request table (default) or json output for commands that support it

The CLI connects to Lawn running on the same Mac. Remote administration through --server or LAWN_SERVER is not supported.

--socket cannot be combined with --server or a set LAWN_SERVER environment variable. Unset LAWN_SERVER before choosing a local socket. Replace the path below with the socket you want to use:

unset LAWN_SERVER
lawn --socket /path/to/engine.sock app list

For example, list installed apps as JSON for scripting:

lawn --output json app list

Some commands keep their own output format even with --output json: lawn app logs prints text, lawn app compose prints YAML, and lawn system cli install prints an installation message.

Shell Completions

Generate tab completions for the shell you use.

Bash

Create a completion file in your home directory:

mkdir -p ~/.local/share/bash-completion/completions
lawn completions bash > ~/.local/share/bash-completion/completions/lawn

Add this line to ~/.bashrc to load the file explicitly. No separate bash-completion package is needed:

source ~/.local/share/bash-completion/completions/lawn

If Bash runs as a login shell, as it does in macOS Terminal, also add this line to ~/.bash_profile so it reads ~/.bashrc:

[[ -r ~/.bashrc ]] && source ~/.bashrc

Run source ~/.bashrc to activate completions in the current shell. New Bash sessions load them through these startup files.

Zsh

Create the completion directory and generate the file:

mkdir -p ~/.zsh/completions
lawn completions zsh > ~/.zsh/completions/_lawn

Add the following to ~/.zshrc. The fpath line must come before any existing compinit call or shell framework initialization. If your configuration already runs compinit, keep that call instead of adding another:

fpath=(~/.zsh/completions $fpath)
autoload -Uz compinit
compinit

Run source ~/.zshrc to activate completions in the current shell, or open a new terminal session.

Fish

Run these commands in Fish. Its completion directory follows your Fish configuration location:

mkdir -p "$__fish_config_dir/completions"
lawn completions fish > "$__fish_config_dir/completions/lawn.fish"
source "$__fish_config_dir/completions/lawn.fish"

The source command activates completions now. Fish loads the file automatically in new sessions.

Command Groups