The technicalities 5 min read 11 September 2023

NPM & N on MacOSX

Amadeusz Kosik
Amadeusz Kosik

Big Data Engineer


Most programming languages have their SDK available for non-system-wide installation. Python offers venv, while Java Development Kit needs only the JAVA_HOME variable to be set, etc. At first glance, this does not seem to be the case with Node.js for JavaScript, where developers are expected to install all tools system-wide, but there are ways to achieve it. One is to use a tool called n – a simple-to-use wrapper and manager for node.js, as described below.


Three short steps that work for MacOSX:

# Install n

brew install n

# Set N_PREFIX to avoid writing into system directories

export N_PREFIX=$HOME/.n

export PATH=$PATH:$N_PREFIX/bin

# Install latest node.js

n latest

The full installation guide is available on the project’s GitHub page: ( 

IntelliJ IDEA

I want to use an IDE to work with node.js apps. Unfortunately, editors like IntelliJ fail to find the node command that is not on the system $PATH. One can work around this issue and use the terminal to execute the framework’s command. However, there is also a more comfortable approach – updating the environment variables.


This one is pretty simple: create or update the `/etc/launchd.conf` file (source: 

setenv N_PREFIX <absolute_path_to_n_prefix>


In case of $PATH variable there is a different way to set it than using launchd:

# Create a file in /etc/paths.d/ with any file name

# and value of directory you want to append to $PATH

echo "/path/to/.n/bin" | sudo tee -a /etc/paths.d/n


More insights