Node.js on OS X 10.8.x Installation Guide shows you how to install node.js, package manager and run your node.js application on localhost that is on your Mac. The first thing we will tell you is that, there are many ways to perform this same thing. We have used our way as it is convenient to our few thousands of users per day. We think they are using (or rather has been synced) in our way. It is not that, you must have to install iTerm2, you can use Terminal App without any problem. As basically we are old Mac users, probably we feel a kind of comfort with the name iTerm.
Node.js on OS X 10.8.x Installation Guide : Basic Setup, Older Tutorials for Preparation and Kind of Alternatives
First come to alternatives. The easiest way to use alternatively is to use a Virtual Appliance – it is the same way we created WordPress Virtual Appliance. This will ensure not to mess your OS X by any means, if you are very keen to keep the port clean. But, we are not going to that way – it is Node.js on OS X 10.8.x Installation Guide. Still, here is ready made version of node.js virtual appliance :
What so ever, we are using iTerm2 plus HomeBrew for this Node.js on OS X 10.8.x Installation Guide. You might not like iTerm2, you might not like HomeBrew, then you have to use GNU make in Terminal or anything like MacPorts, there are actually many ways.
These three guides are important if you are quite new to these things, these are essential steps for any kind of localhost setup, git local repo etcetera :
- Fixing UNIX Commands After OSX 10.8 Updates (Fixing is a bit misnomer)
- Customize iTerm2 with Color Schemes, Syntax Highlighting (Optional)
- Syntax Highlighting in Vim inside iTerm2 (Optional, ahh…I forgot to update that text snippet there, there are more functions than actually written)
Node.js on OS X 10.8.x Installation Guide
So you have a ready setup. Xcode is also installed. Only few commands will work to create the setup. Run brew update command if you have installed HomeBrew long ago.
Technically, the command :
brew install node
Should work. But it is depreciated. So, we can clone this official git :
There is nicely written guide for Installation ! Here is the manual method in short :
git clone git://github.com/creationix/nvm.git ~/.nvm
echo ". ~/.nvm/nvm.sh" >> ~/.bashrc
nvm install -s v0.10.4 (Please check the version number and make it to current one)
nvm alias default v0.10.4
curl http://npmjs.org/install.sh | clean=no sh
brew install mongodb
But you you have to create a directory with mkdir command. Like db in the location /usr/local/db. Read their official docs.
Practically, its ready, you can check with the command :
Now, if I want to create an app named app.js then the example app will be :
So, run the command :
and copy paste that above bigger snippet. Save it. Start your app :
As I have added at 3000, you should point your browser to :
You will see It Works! message like Apache2 ‘s default message. It Works really sound better than Hello World.