Run the Claude Code Proxy as a system service so it starts on boot (or at login on macOS) and restarts on failure.
- Linux: systemd
- macOS: launchd (user agent, runs at login)
Ensure you have configured .env in the directory you use as WorkingDirectory below.
-
Install the package (from repo root):
uv pip install -e . # or: pip install .
This installs the
claude-code-proxyconsole script. -
Install the unit file:
Copy
deploy/claude-code-proxy.serviceto/etc/systemd/system/. Edit the unit file: setWorkingDirectoryandEnvironmentFile(and optionallyExecStart) to your install path, e.g./opt/claude-code-proxyor your repo path.sudo cp deploy/claude-code-proxy.service /etc/systemd/system/ sudo sed -i 's|/opt/claude-code-proxy|/path/to/your/claude-code-proxy|g' /etc/systemd/system/claude-code-proxy.service sudo systemctl daemon-reload -
Enable and start:
sudo systemctl enable claude-code-proxy sudo systemctl start claude-code-proxy sudo systemctl status claude-code-proxy
Useful commands:
- Logs:
journalctl -u claude-code-proxy -f - Stop:
sudo systemctl stop claude-code-proxy - Restart:
sudo systemctl restart claude-code-proxy
Host/port can be overridden with HOST and PORT in .env or in the unit file’s Environment= lines.
You can run the proxy as a launchd agent so it starts at login and restarts if it exits.
-
Install the package (from repo root):
uv pip install -e . # or: pip install .
Ensure
.envis in the same directory you will use asWorkingDirectorybelow. -
Install the plist:
Copy
deploy/com.claude-code-proxy.plistto~/Library/LaunchAgents/. Edit the plist and replace/opt/claude-code-proxywith your install path (the directory that contains.envand.venv). The firstProgramArgumentsstring must be the full path to the executable, e.g./Users/you/claude-code-proxy/.venv/bin/claude-code-proxy;WorkingDirectorymust be that directory (e.g./Users/you/claude-code-proxy).cp deploy/com.claude-code-proxy.plist ~/Library/LaunchAgents/ # Edit the plist: replace /opt/claude-code-proxy with your path in both ProgramArguments and WorkingDirectory # e.g. sed -i '' 's|/opt/claude-code-proxy|/Users/you/claude-code-proxy|g' ~/Library/LaunchAgents/com.claude-code-proxy.plist
-
Load and start:
launchctl load ~/Library/LaunchAgents/com.claude-code-proxy.plist
Useful commands:
- Stop:
launchctl unload ~/Library/LaunchAgents/com.claude-code-proxy.plist - Start again:
launchctl load ~/Library/LaunchAgents/com.claude-code-proxy.plist - Logs (default):
tail -f /tmp/claude-code-proxy-stdout.logandtail -f /tmp/claude-code-proxy-stderr.log. You can changeStandardOutPath/StandardErrorPathin the plist to another path.
Host/port can be set with HOST and PORT in .env (the app loads .env from WorkingDirectory).