DEV Community

Peter Witham
Peter Witham

Posted on

8 2

Install and Update NodeJS on the Mac with NVM

I thought I would share an older post on my site that I found myself pointing a few people too over the weekend when they wanted to maintain NodeJS versions without the hassle.

Nodejs is great, but I always seem to end up explaining to people how to install it. so here is my way, once and for all.

There are installers for Windows and Mac, there are also binaries for Windows, Mac, Linux and I believe SunOS. Plus there is the source code if you want to compile it yourself.

Personally, I like to use the ‘NVM’ way, which stands for Node Version Manager. Not only does it keep things simple but you can also install and switch to as many different versions of Node.js as you please.

Install nvm

I’m doing this on a Mac, but it’s pretty much the same on all platforms once you have installed nvm. So go to https://github.com/creationix/nvm and install it now. Since I’m doing this on a Mac I have already ensured I meet the requirements of having Xcode installed for the c++ compiler.

I’ll open up a terminal and follow the instruction to run the install script. Worth noting that if you already have nvm installed you can update it using the same commands.

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash

Install Node

Now go over to https://nodejs.org where I see it’s telling me the latest stable release is v10.15.0 LTS. I see there is a v11.8 Current with all the latest features, but I’m not using that one today.

So I simply use the terminal and nvm to install it with

nvm install 10.15.0

I’ll set the current version I want to use to the same

nvm use 10.15.0

And since I want to use this version over time (in case I had more than one installed) I’ll also set it to the default.

nvm alias default 10.15.0

That my friends is all there is to it! type

node —version

And voila, it tells me the version I have is

v10.15.0

We are done, now sit back and grin or write some code!

Sentry blog image

How I fixed 20 seconds of lag for every user in just 20 minutes.

Our AI agent was running 10-20 seconds slower than it should, impacting both our own developers and our early adopters. See how I used Sentry Profiling to fix it in record time.

Read more

Top comments (0)

SurveyJS custom survey software

Simplify data collection in your JS app with a fully integrated form management platform. Includes support for custom question types, skip logic, integrated CCS editor, PDF export, real-time analytics & more. Integrates with any backend system, giving you full control over your data and no user limits.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay