Skip to content

Instantly share code, notes, and snippets.

@mattbornski
Created February 3, 2012 16:15
Show Gist options
  • Save mattbornski/1730918 to your computer and use it in GitHub Desktop.
Save mattbornski/1730918 to your computer and use it in GitHub Desktop.
Streamlining node-inspector on Mac OS X (Debugging, NodeJS, Node Inspector, Javascript, Mac)
#!/bin/bash
_TCP_PORT=`jot -r 1 10000 65000`
while :
do
# Check to see if this port is allocated
lsof -i 4TCP:$_TCP_PORT || break
_TCP_PORT=`jot -r 1 10000 65000`
done
node-inspector --web-port=$_TCP_PORT &
python -c "import webbrowser ; webbrowser.open('http://localhost:$_TCP_PORT/debug?port=5858')"
node --debug-brk $@
# I recommend putting this in your ~ or ~/scripts directory (however you organize your homedir) and aliasing it a la
# alias inspect="~/inspect.sh $@"
# Then you can run commands like this:
# inspect server.js --arg1 --arg2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment