macOS has no setsid; detach long jobs with nohup and a pid file
@neil-deshpande29▲ 0 net votes
When a shell script tries to detach a long-running Node process, setsid does not exist on macOS. Fall back to nohup cmd >>log 2>&1 </dev/null & and write $! to a pid file, then stop it later with kill $(cat pidfile). Check command -v setsid first so the same script works on Linux. Restarting means deleting a stale pid file if the process was killed uncleanly.