Skip to content

launchd Service (macOS user)

This project ships launchd templates in launchd/ for manual setup on macOS.

opencode-telegram-bridge setup

This is the recommended path. It writes the launchd plist and env file for your machine and starts the service for you.

Advanced: manual install

Only use this if you cannot run the wizard. It is easy to misconfigure paths or environment values and end up with a service that does not start.

  1. Install the package:
npm install -g opencode-telegram-bridge
  1. Locate the installed package so you can copy the bundled launchd files:
npm root -g

The launchd templates live at:

<npm root -g>/opencode-telegram-bridge/launchd/
  1. Copy the launchd plist:
mkdir -p ~/Library/LaunchAgents
cp "$(npm root -g)/opencode-telegram-bridge/launchd/opencode-telegram-bridge.plist" \
  ~/Library/LaunchAgents/com.opencode.telegram-bridge.plist
  1. Edit the plist:

  2. Replace /path/to/node with command -v node.

  3. Replace /path/to/opencode-telegram-bridge/dist/cli.js with:
echo "$(npm root -g)/opencode-telegram-bridge/dist/cli.js"
  • Replace REPLACE_ME values with your Telegram credentials.
  • Replace ~/Library/Logs/... with absolute paths (launchd does not expand ~).

  • Load and start:

launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/com.opencode.telegram-bridge.plist
launchctl enable gui/$(id -u)/com.opencode.telegram-bridge
launchctl kickstart -k gui/$(id -u)/com.opencode.telegram-bridge

Optional: OpenCode server agent

If you want opencode serve to run as a launchd agent too:

cp "$(npm root -g)/opencode-telegram-bridge/launchd/opencode-server.plist" \
  ~/Library/LaunchAgents/com.opencode.server.plist

Edit the plist: - Replace /path/to/opencode with command -v opencode. - Replace /path/to/node/dir with dirname "$(command -v node)". - Replace ~/Library/Logs/... with absolute paths.

Then load and start:

launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/com.opencode.server.plist
launchctl enable gui/$(id -u)/com.opencode.server
launchctl kickstart -k gui/$(id -u)/com.opencode.server

Logs

tail -f ~/Library/Logs/opencode-telegram-bridge.log

Start on boot (optional)

LaunchAgents start on login. To start before login, use a LaunchDaemon (requires sudo).