

On Linux and macOS, n-install allows installation directly from GitHub for instance: curl -L | bash Or on macOS with MacPorts you can install the n port: port install n

On macOS with Homebrew you can install the n formula. To install n in a custom location (such as $CUSTOM_LOCATION/bin/n), run PREFIX=$CUSTOM_LOCATION make install. To install n to bin/n of the directory specified in the environment variable $PREFIX, which defaults to /usr/local (note that you will likely need to use sudo). # If you want n installed, you can use npm now.Īlternatively, you can clone this repo and make install To install the lts version of Node.js: curl -fsSL | bash -s lts If npm is not yet available, one way to bootstrap an install is to download and run n directly. Sudo chown -R $(whoami) /usr/local/bin /usr/local/lib /usr/local/include /usr/local/share # take ownership of Node.js install destination folders Sudo mkdir -p /usr/local/bin /usr/local/lib /usr/local/include /usr/local/share # make sure the required folders exist (safe to execute even if they already exist) To avoid requiring sudo for n and npm global installs, it is suggested you either install to your home directory using N_PREFIX, or take ownership of the system directories: # make cache folder (if missing) and take ownership The active Node.js version is installed in subdirectories bin, include, lib, and share. N caches Node.js versions in subdirectory n/versions. The n command downloads and installs to /usr/local by default, but you may override this location by defining N_PREFIX. If you already have Node.js installed, an easy way to install n is using npm: npm install -g n N does not work in native shells on Microsoft Windows (like PowerShell), or Git for Windows BASH, or with the Cygwin DLL.

It is written as a BASH script but does not require you to use BASH as your command shell. N is supported on macOS, Linux, including with Windows Subsystem for Linux, and various other unix-like systems.
