DEV Community

Cover image for How to Get Started With Node and NVM on MacOS (M1/ M2) in 2023
Gerry Aballa
Gerry Aballa

Posted on

How to Get Started With Node and NVM on MacOS (M1/ M2) in 2023

What are Node and NVM?

Node.Js, commonly known as Node, is a JavaScript runtime for building server-side or desktop applications. Node Version Manager(NVM) allows you to manage Node versions on your device. It is important because different projects on your device may be needing different versions of Node.

Having NVM and Node installed is a likely requirement for software engineers in 2023. This article has steps that make it easy to install Node and NVM on the new Apple Silicon Macs.


Step 1: Installing NVM

Run the following command in a new terminal window that will list all the files including hidden files in your device:

ls -a
Enter fullscreen mode Exit fullscreen mode

If .zshrc is missing from the list, you need to create it by running the following command:

touch .zshrc
Enter fullscreen mode Exit fullscreen mode

Insure you have the .zshrc now available in the list. Use cURL command from this site to install NVM. Copy and run this command in your terminal. It will look similar to this:

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.2/install.sh | bash
Enter fullscreen mode Exit fullscreen mode

You will need to refresh the .zshrc file by running the following command:

source .zshrc
Enter fullscreen mode Exit fullscreen mode

You can now confirm that you have NVM installed by running the following command. You should get a figure like 0.39.2.

nvm -v 
Enter fullscreen mode Exit fullscreen mode

Step 2: Installing Node

Installing Node is now easy. Run this command in your terminal:

nvm install node
Enter fullscreen mode Exit fullscreen mode

To install a specific version of Node, just add the version number at the end like this:

nvm install 18.12.1
Enter fullscreen mode Exit fullscreen mode

To use Node, you will first have to run the following command in your terminal:

nvm use node
Enter fullscreen mode Exit fullscreen mode

or run a specific version of Node:

nvm use 18.12.1
Enter fullscreen mode Exit fullscreen mode

Remember Node installation includes the Node Package Manager(NPM). You are ready to use all the resources that Node presents to you. Thank you for getting to the end of this article. You are great!

Photo by AltumCode on Unsplash

Top comments (0)