News App - macOS Service Management ==================================== Service: com.je.carnews Port: 5555 Plist: /Library/LaunchDaemons/com.je.carnews.plist BASIC COMMANDS -------------- Start the service: sudo launchctl kickstart system/com.je.carnews Stop the service: sudo launchctl kill SIGTERM system/com.je.carnews Restart the service: sudo launchctl kickstart -k system/com.je.carnews Check status: sudo launchctl print system/com.je.carnews Check if running: lsof -i :5555 ADD TO STARTUP (BOOT) --------------------- 1. Copy the plist to LaunchDaemons: sudo cp /opt/homebrew/var/www/news-app/com.je.carnews.plist /Library/LaunchDaemons/ 2. Load the service: sudo launchctl bootstrap system /Library/LaunchDaemons/com.je.carnews.plist 3. Start it: sudo launchctl kickstart system/com.je.carnews The service will now start automatically on boot. REMOVE FROM STARTUP (BOOT) -------------------------- 1. Stop and unload the service: sudo launchctl bootout system/com.je.carnews 2. Remove the plist file: sudo rm /Library/LaunchDaemons/com.je.carnews.plist The service will no longer start on boot. VIEW LOGS --------- Output log: tail -f /opt/homebrew/var/www/news-app/logs/out.log Error log: tail -f /opt/homebrew/var/www/news-app/logs/error.log TROUBLESHOOTING --------------- If the service fails to start, check: 1. Node version - the plist uses: /Users/jared/.nvm/versions/node/v22.19.0/bin/node 2. If you update Node via nvm, rebuild native modules: cd /opt/homebrew/var/www/news-app npm rebuild better-sqlite3 3. Then update the node path in the plist if needed and reload: sudo launchctl bootout system/com.je.carnews sudo launchctl bootstrap system /Library/LaunchDaemons/com.je.carnews.plist sudo launchctl kickstart system/com.je.carnews