Background Service

Run Broski Link as a background service that starts automatically when you log in.

Overview

Running broski in a terminal works, but it stops when you close the window. broski install registers broski-link as a service that:

  • Starts automatically when you log in
  • Starts the bridge for you and restarts it if it crashes
  • Accepts connections from your paired phones, directly or through a relay
  • Logs output to files for debugging
macOS and Linux
The service uses launchd on macOS and a systemd user service on Linux. Windows is not supported.

Quick Setup

bash
# Install and start the service
broski install

# Check status
broski status
broski-link status

# Show a QR code to pair your phone
broski-link pair

# Restart after changing ~/.broski/link/config.json
broski restart

# Stop the service
broski stop

# Remove the service
broski uninstall
Recommended Workflow
Run broski install once, then use broski-link pair whenever you need to pair a new device. The service keeps running in the background.

What Gets Installed

PlatformServiceDefinition
macOSLaunchAgent com.broski.link~/Library/LaunchAgents/com.broski.link.plist
Linuxsystemd user service broski-link~/.config/systemd/user/broski-link.service
Linux: keep it running after you log out
For the service to run after you log out, enable lingering:
bash
loginctl enable-linger $USER

Log File Locations

FileContents
~/.broski/logs/link.logbroski-link output: pairing, routes, relay, bridge supervision
~/.broski/logs/bridge.logBridge standard output
~/.broski/logs/bridge.error.logBridge error output

View Logs

bash
# Follow the bridge logs
broski logs --follow

# Follow the link log
tail -f ~/.broski/logs/link.log

# Linux (systemd journal)
journalctl --user -u broski-link -f

Automatic Restarts

Two layers keep things running:

  • broski-link restarts the bridge 1 to 30 seconds after it exits, and shows crashed with the reason in broski-link status.
  • launchd (macOS) or systemd (Linux) restarts broski-link itself if it exits.

Pairing a Phone

A background service has no terminal to show a QR code, so ask it for one:

bash
broski-link pair

The code is single-use and expires after 10 minutes. Once a phone is paired it reconnects on its own; you do not need to scan again.

Troubleshooting

Service not starting

  • Check logs: tail ~/.broski/logs/link.log
  • Ensure the broski-link binary is installed next to broski
  • Run broski doctor to check requirements

Can't connect from phone

  • Run broski status and broski-link status
  • Check the firewall isn't blocking the Broski Link port (default 18275)
  • Run broski-link pair for a fresh QR code

Bridge keeps restarting

  • Check ~/.broski/logs/bridge.error.log for the crash reason
  • Verify an agent is installed: claude --version or pi --version
  • Check if port 18274 is in use by another process
  • Try running manually first: broski in a terminal

Permission denied errors

  • Ensure the service runs as your user, not root
  • Check file permissions on ~/.broski/
  • Verify broski is executable: ls -la ~/.broski/bin/broski

Next Steps