Contents

Install Node and N - Node Version Management on MacOS



Install node from official site

Node Official Website


Select “macOS Installer (.pkg)” file. Download and install it as usual.



Install ‘n’ - for node version management


1
npm install -g n

To avoid using sudo, do (excerpt from official n docs - Link)

1
2
3
4
5
6
7
# make cache folder (if missing) and take ownership
sudo mkdir -p /usr/local/n
sudo chown -R $(whoami) /usr/local/n
# make sure the required folders exist (safe to execute even if they already exist)
sudo mkdir -p /usr/local/bin /usr/local/lib /usr/local/include /usr/local/share
# take ownership of Node.js install destination folders
sudo chown -R $(whoami) /usr/local/bin /usr/local/lib /usr/local/include /usr/local/share

Now one can switch node version easily by executing ‘n’ command

For switch to Node 12, do

1
n 12


Hope this helps!