Beginners Guide to Node.js: Installing Node on MacOS Sierra

Published Jan 03, 2017Last updated Apr 03, 2017
Beginners Guide to Node.js: Installing Node on MacOS Sierra

This is originally posted by the author on a different website. This post has been edited for clarity and some parts may appear different from the original post.

If you are new to Node.js and still exploring, you might be very confused with the tons of ways to install it. While some guides only cover Linux or Windows, if you want to get started playing with Node.js and you are using a Mac with the latest updates installed, then this guide is for you!

Well then, let's get started!


NVM (Node Version Manager): Simple bash script to manage multiple active Node.js versions

For our convenience, we will be using NVM, it's a very simple command line tool that lets us download, update, and switch to any Node version available with just a few commands, isn't that neat?

Installing NVM

To Install NVM on the Mac, let's start by opening:

TERMINAL, you can do that by clicking the FINDER button in the Mac OS interface. Then type terminal and press the enter key on your keyboard.

Once it's open and running, you should see the TERMINAL window similar to this.

installing nodejs on macos sierra

From here we can now install NVM by typing or copying these lines:

touch ~/.bash_profile
curl -o- | bash

And NVM should now be installed in your system!

Now you will have to re-open your TERMINAL to actually use NVM, so go ahead and close TERMINAL and open it again (like you did before!)

We can verify if NVM has been successfully installed by typing this command:

nvm --version

The output should look something like this:

installing nodejs on macos sierra

Installling Node on Mac

Now we are ready to actually install Node! (Yes I know, you thought it was over, did you?) You are probably thinking what?!? More commands? I can't wait anymore!!!

Well no worries, you can easily install NodeJS with nvm in just two steps.

Step 1:

Type and enter nvm ls-remote

nvm ls-remote

You should see a list of all available versions of NodeJS.

installing nodejs on macos sierra

As you can see, I currently have version 7.1.0 of Node.js installed (indicated by the arrow and color highlight).

Step 2:

Now if you wanted to install v7.2.0, it would be as easy as typing: nvm install 7.2.0

nvm install 7.2.0

And that's it! You already have the latest version of Node.js installed very easily!

installing nodejs on macos sierra

Verifying installation

You can verify that you really have Node.js installed by typing: `node -v"

node -v

installing nodejs on macos sierra

And as expected it will show you the Node.js version you just installed.

Wrapping up

Congratulations, You have NodeJS installed. Enjoy!

For other Node.js beginner tutorials, you can read Ruby on Rails vs. Node.js ─ Which Backend Technology Should Beginners Learn?, Getting Started with Node.js + MySQL, or A to Z List of Useful Node.js Modules

Discover and read more posts from Clark Alesna
get started
Enjoy this post?

Leave a like and comment for Clark

Juha Metsäkallas
3 months ago

One tiny thing is left out… How you set up Eclipse (or some other IDE) to use Node.js? I have a Javascript snipet that seems to use some Node.js features, at least when I’m trying to run it in Eclipse I get an error saying that need to configure a path somewhere. What and where? TIA

Clark Alesna
3 months ago

You can use NodeJS with any text editor as long as it supports javascript file syntax highlight / code completion.

But i think you are referring to running and debugging from inside Eclipse? If that is the case I’m not familiar with setting that up.

But I would recommend it has built-in support for Javascript and NodeJS debugging!

Happy coding!

Get curated posts in your inbox

Read more posts to become a better developer