Proxydetox as user service

Register Proxydetox as a user service such that it is automatically started by the system when the user is logged in.

Note: This steps are only required when using cargo install. When installing the provided packages this steps are not necessary.

Automatically start Proxydetox with a user session

To automatically start proxydetox when an user session is active, we can register it with systemd(8) on Linux or launchd(8) on macOS.

Linux

Create a file ~/.config/systemd/user/proxydetox.service, you can use debian/proxydetox.service as template, but make sure to update the ExecStart part with an absolute path.

To finally enable the service, us the following commands:

systemctl --user daemon-reload
systemctl --user enable proxydetox.service
systemctl --user start proxydetox.service

macOS

Create a file ~/Library/LaunchAgents/cc.colorto.proxydetox.plist, you can use cc.colorto.proxydetox.plist as template, but make sure to update the ProgramArguments value with an absolute path.

The following steps need to be executed as the user who wants to use proxydetox (i.e. not as root).

  launchctl bootstrap "gui/$(id -u)" "/Library/LaunchAgents/cc.colorto.proxydetox.plist"
  launchctl enable "gui/$(id -u)/cc.colorto.proxydetox"
  launchctl print "gui/$(id -u)/cc.colorto.proxydetox"
  launchctl kickstart -kp "gui/$(id -u)/cc.colorto.proxydetox"

To revert the above changes (i.e. you want to uninstall proxydetox), run the following commands:

  launchctl kill SIGTERM "gui/$(id -u)/cc.colorto.proxydetox"
  launchctl disable "gui/$(id -u)/cc.colorto.proxydetox"
  launchctl bootout "gui/$(id -u)/cc.colorto.proxydetox"