UniClipboard
CLI & Headless Service

Headless Deployment

Run unicd continuously on a server or in a desktop-free environment.

Edit on GitHub

The temporary service started on demand by unic only exists while a command is running, so nothing is received between commands. To keep a machine online continuously for sending and receiving, run unicd as a persistent service.

Running unicd

UNIC_HOME=/absolute/private/state unicd
  • Each data directory holds one service, one device identity, and one history database.
  • A unicd you started yourself is never stopped by any unic command; unic reuses it directly.
  • unicd loads no GUI libraries and starts headless by default.
  • Headless environments have no system clipboard adapter: history use, history action --apply, dev copy, and dev paste are unavailable; receiving content is unaffected and received items can be read with unic history and unic recv list.

You must complete initial setup on the data directory before use, e.g. UNIC_HOME=/absolute/private/state unic init (or unic init --json / unic migrate --initialize-empty --json in scripts).

Start at User Login

unic service enable
unic service status --json
unic service disable

Initialize the profile first with unic init. Use --profile NAME to select a named profile. Run enable again after moving the installation. Run unic daemon start to start syncing in the current session.

This feature uses a user LaunchAgent on macOS, a systemd user service on Linux, or a user logon task on Windows. It needs no administrator privileges. The Linux systemd user manager controls when its user session starts. Disabling startup leaves the current service and all profile data in place.

Managing with a Service Manager

For a separately managed Linux deployment, use a systemd unit with your preferred service policy. Use one service manager entry per profile. This example uses the current user's systemd manager.

# ~/.config/systemd/user/unicd.service
[Unit]
Description=unic clipboard service

[Service]
Environment=UNIC_HOME=%h/.local/share/unic
ExecStart=/usr/local/bin/unicd
Restart=on-failure

[Install]
WantedBy=default.target
systemctl --user daemon-reload
systemctl --user enable --now unicd

When running unic as the same user, be sure to use the same UNIC_HOME (or UNIC_SOCK) to connect to this service.

Pairing and Sending

export UNIC_HOME=/absolute/private/state
unic device add                       # display pairing code
unic device list
unic device approve <id> '<fingerprint>'
echo hello | unic send --to all --json

Multiple Local Nodes

Use distinct UNIC_HOME directories to run independent nodes on the same machine for testing:

UNIC_HOME=/tmp/unicA unicd &
UNIC_HOME=/tmp/unicB unicd &

Coexisting with Desktop

If standalone unicd is already running for the selected profile, Desktop connects to it. If Desktop starts first while CLI login startup is enabled, Desktop starts a standalone service. Quitting Desktop leaves that service running in either case. If a temporary unic-managed service is running, retry Desktop startup after the command finishes.

Configuration and Logs

  • The configuration file is config.toml in the data directory and reloads on save; a few keys require restarting unicd and are listed by unic config. See Configuration Reference.
  • Remote logs, metrics, and events are enabled by default and can be disabled in config.toml:
[telemetry]
enabled = false
  • Exporting local logs does not require the service to be running: unic dev logs export --output ./unic-logs.tar.gz. See Diagnostics.

Known Limitations

  • Whether the service continues running after logging out depends on your service manager.
  • Process-level acceptance runs on the host platform only; native clipboard acceptance on macOS, Windows, and Linux is tracked separately.

On this page