Skip to content

Instantly share code, notes, and snippets.

@ahmadawais
Created July 1, 2022 14:17
Show Gist options
  • Save ahmadawais/87c1c20d083903d698008ae96e854252 to your computer and use it in GitHub Desktop.
Save ahmadawais/87c1c20d083903d698008ae96e854252 to your computer and use it in GitHub Desktop.
The best way to install Node.js on Mac
# Node.
brew install node
brew install n
n lts
brew uninstall node # Not needed anymore from brew.
npm i -g git-open
@MahamDev
Copy link

MahamDev commented Jul 1, 2022

I there's a permission error, when installing n run the following commands before n lts command.

# 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment