Installing Node.js on macOS Big Sur using nvm

Photo by Lukas Hellebrand on Unsplash

I recently clean installed macOS Big Sur and is in the process of setting up all my software. As part of the spring cleaning process I wanted to clear out all of the GitHub forks that I accumulated like a snowball.

To help in this process I found delete-github-forks that can bulk delete GitHub forks and this tool is written using Node.js

So I thought it would be a good idea to document how I install node on macOS Big Sur.

Installing nvm

nvm (node version manager) allows you to have multiple versions of node installed and thus help avoid compatibility issues when projects use different versions of node.

Get the latest command line script to be run from and then run the command in the terminal. It is always a good idea to first read the script before just blindly running it.

The script will make changes to .zshrc so I backup mine first and then install nvm.

Note: If you don’t have a .zshrc file yet then you need to create it first (touch ~/.zshrc)

$ cp .zshrc .zshrc.bak
$ curl -o- | bash

Then I verify the changes made to .zshrc

$ diff .zshrc .zshrc.bak
< export NVM_DIR="$HOME/.nvm"
< [ -s "$NVM_DIR/" ] && \. "$NVM_DIR/"  # This loads nvm
< [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion

Relaunch the terminal and verify nvm

$ nvm -v

Installing node

To install the latest version of node.

$ nvm install node

Verify the version of node being used.

$ nvm run node --version
Running node v15.10.0 (npm v7.5.3)

You can also now just use node directly
$ node --version

To install a different version of node.

$ nvm install 14.16.0
$ nvm use 14.16.0

List the installed versions.

$ nvm ls

See for more information on how to use nvm.

1 comment on “Installing Node.js on macOS Big Sur using nvm

Leave a comment

Your email address will not be published. Required fields are marked *