Skip to content
Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
96 lines (80 sloc) 2.16 KB

Daemonize Cheat Sheet


Download NSSM

Run Command Prompt as an administrator and type:

nssm.exe install [ServiceName]

On the NSSM window, enter the following info


Path: C:\path\to\file.exe
Startup directory: C:\path\to\
Arguments: arg1 arg2


Display name: [ServiceName]
Description: [A Description]


Output: C:\path\to\stdout.log
Error: C:\path\to\stderr.log

To start your service

net start [ServiceName]

Uninstall service

net stop [ServiceName]
nssm remove [ServiceName]


Create a Launch daemon

sudo nano  /Library/LaunchDaemons/org.yourdaemon.plist

Paste your custom XML

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">

Change permissions, load and start

sudo /usr/sbin/chown root:wheel /Library/LaunchDaemons/org.yourdaemon.plist
sudo /bin/launchctl load /Library/LaunchDaemons/org.yourdaemon.plist
sudo /bin/launchctl start org.yourdaemon

Stop and Remove

sudo /bin/launchctl stop org.yourdaemon
sudo /bin/launchctl unload /Library/LaunchDaemons/org.yourdaemon.plist
sudo rm /Library/LaunchDaemons/org.yourdaemon.plist
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.