(1) install node.js from http://nodejs.org/
(2) Go to Tools -> Build System -> New Build System
(3) Name the file it to "Node.sublime-build" and change the default content to
{
"cmd": ["/usr/local/bin/node", "$file", "$file_base_name"],
"working_dir": "${project_path:${folder}}",
"selector": "*.js"
}
and save.
(4) Restart your sublime text, go to Tools -> Build System and select "Node" for your build system.
(5) Hit "Command + b" for building your file.