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 :
1 | http://www.turnkeylinux.org/nodejs |
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 :
1 | brew install node |
Should work. But it is depreciated. So, we can clone this official git :
1 | https://github.com/creationix/nvm |
There is nicely written guide for Installation ! Here is the manual method in short :
1 | git clone git://github.com/creationix/nvm.git ~/.nvm |
1 | echo ". ~/.nvm/nvm.sh" >> ~/.bashrc |
1 | nvm install -s v0.10.4 (Please check the version number and make it to current one) |
1 | nvm alias default v0.10.4 |
1 | curl http://npmjs.org/install.sh | clean=no sh |
A noSQL database is required. You can use MongoDB.It is optional. Installing is easy :
1 | 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 :
1 | node -v |
Now, if I want to create an app named app.js then the example app will be :
So, run the command :
1 | vi app.js |
and copy paste that above bigger snippet. Save it. Start your app :
node app.js
As I have added at 3000, you should point your browser to :
http://localhost:3000/
You will see It Works! message like Apache2 ‘s default message. It Works really sound better than Hello World.
Tagged With how to install node js on mac os x 10 8 , node mac setup nom , node js osx , Node Install OSX , node application OS X , MAc OS X install node , install node on osx , how to update node js local macosx , how to launch node js application in Mac OSx , run node on osx