Headless, non-interactive LocalSend CLI for Linux/macOS/Windows. Designed for LLM automation and scripting: no prompts, deterministic exit codes, optional JSON output.
curl -fsSL https://github.com/aduggleby/localsend-cli/releases/latest/download/localsend-cli-$(uname -s | tr '[:upper:]' '[:lower:]')-$(uname -m).tar.gz | tar -xz
sudo install -m 755 localsend-cli /usr/local/bin/localsend-cli- Fully non-interactive (all behavior controlled by flags)
- Discover devices (multicast + optional subnet scan)
- Send text, files, directories (directories are zipped), and globbed file lists
- Receive mode with auto-accept and optional PIN
- Optional JSON output for machine control
- Native binaries for Linux/macOS/Windows
Use the GitHub Releases artifacts for your OS.
cargo build --release
./target/release/localsend-cli --helpList devices:
localsend-cli list
localsend-cli list --jsonSend a file:
localsend-cli send --to "Alice" --file ./photo.jpgSend a file with QR fallback (recommended on multi-network setups):
localsend-cli send --to "Alice" --file ./photo.jpg --qrStart a QR web share server immediately (no discovery):
localsend-cli webshare --text "test"Send text:
localsend-cli send --to 192.168.1.42 --text "Hello from CLI"Send a directory (zipped):
localsend-cli send --to "office-pc" --dir ./projectReceive files (auto-accept):
localsend-cli receive --output ./downloadsReceive exactly 1 file then exit:
localsend-cli receive --output ./downloads --max-files 1--to can match any of:
- device id (fingerprint)
- device alias (case-insensitive)
- hostname (if the alias equals hostname)
- IP address
If you already know the target address, you can bypass discovery:
localsend-cli send --direct 192.168.1.42:53317 --file ./report.pdfIf the receiver requires a PIN, pass it with --pin:
localsend-cli send --to "Alice" --file ./secret.txt --pin 123456Receiver can require a PIN:
localsend-cli receive --pin 123456If discovery fails, --qr starts a local web share server and prints a terminal QR code so the receiver can open the link and download the files in a browser. By default the link uses HTTPS (self-signed).
Some commands are long-running or wait on other devices:
send: blocks while it waits for the receiver to accept and while uploads finish. If the receiver is busy, the command exits with an error.receive: runs a server and blocks until you stop it (Ctrl+C).webshare: runs a server and blocks until you stop it (Ctrl+C).
For automation, run long-lived commands in a separate process or use your own timeout.
- LocalSend v2
/prepare-uploadexpectsfilesas a map ofid -> file(not a list). - Text messages are modeled as a file; using the
previewfield mirrors GUI behavior. - Some receivers return
204 No Contentfor message-only transfers; treat as success. - Direct IP sends should probe
/infoto resolve protocol (HTTP vs HTTPS). - Tailscale peers may only expose HTTP on the LocalSend port; probe both.
Use --json to enable machine-readable output. For example:
localsend-cli list --json
localsend-cli send --to "Alice" --file ./photo.jpg --json
localsend-cli receive --output ./downloads --jsonThis CLI implements the LocalSend v2.1 protocol endpoints:
POST /api/localsend/v2/registerGET /api/localsend/v2/infoPOST /api/localsend/v2/prepare-uploadPOST /api/localsend/v2/upload
- Directories are zipped before transfer to preserve structure.
- HTTPS uses a self-signed certificate and accepts invalid certs for interoperability.
- Subnet scanning is optional (
localsend-cli list --scan) and may be slow on large networks.
Run locally:
cargo run -- list
cargo run -- send --to 192.168.1.42 --file ./photo.jpg
cargo run -- receive --output ./downloadsMIT