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 uninstallRecommended 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
| Platform | Service | Definition |
|---|---|---|
| macOS | LaunchAgent com.broski.link | ~/Library/LaunchAgents/com.broski.link.plist |
| Linux | systemd 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 $USERLog File Locations
| File | Contents |
|---|---|
| ~/.broski/logs/link.log | broski-link output: pairing, routes, relay, bridge supervision |
| ~/.broski/logs/bridge.log | Bridge standard output |
| ~/.broski/logs/bridge.error.log | Bridge 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 -fAutomatic Restarts
Two layers keep things running:
broski-linkrestarts the bridge 1 to 30 seconds after it exits, and showscrashedwith the reason inbroski-link status.- launchd (macOS) or systemd (Linux) restarts
broski-linkitself 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 pairThe 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-linkbinary is installed next tobroski - Run
broski doctorto check requirements
Can't connect from phone
- Run
broski statusandbroski-link status - Check the firewall isn't blocking the Broski Link port (default 18275)
- Run
broski-link pairfor a fresh QR code
Bridge keeps restarting
- Check
~/.broski/logs/bridge.error.logfor the crash reason - Verify an agent is installed:
claude --versionorpi --version - Check if port 18274 is in use by another process
- Try running manually first:
broskiin 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