node-launchd ============


A Node.js Addon to get sockets from launchd upon (port-activated) launching on osx

Suppose, you created an app using express in directory


, and your node installation lives in


and you want your app to use port 8080.

First, create a launchd configuration file (e.g., yourapp.plist) in


, fill it with content such as this

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

change the app.js file in you project directory to start the http server using a launchd file handle like this


Finally, you can load the launchd configuration file like this

launchctl load -w ~/Library/LaunchAgents/yourapp.plist