Installation on macOS
The simplest method is Homebrew: brew install node installs the runtime and npm in one command. This formula tracks the current version of Node.js, not the LTS; to pin a long-term support release, install a versioned formula such as brew install node@24 (there is no node@lts formula). The binary is located in /opt/homebrew/bin/node on Apple Silicon Macs (M1 and later) and in /usr/local/bin/node on Intel Macs. Check your PATH if the node command is not found after installation.
Managing multiple versions
If your projects require different versions of Node.js, do not install the global Homebrew package: use a version manager such as nvm or fnm instead. This avoids conflicts and lets you switch per project with a .nvmrc file. nvm is a shell function that must be sourced: after brew install nvm, run export NVM_DIR="$HOME/.nvm" then . "$(brew --prefix nvm)/nvm.sh" before nvm install --lts, and add those lines to your ~/.zshrc for future sessions. Note that Homebrew's node formula and an nvm installation can conflict in the PATH; choose a single approach.
Configuration and cleanup
The ~/.npmrc file stores npm's configuration (private registry, proxy, authentication token). Globally installed packages reside in the npm prefix (often /opt/homebrew/lib/node_modules). Homebrew's node formula no longer includes Corepack: to enable pnpm or yarn, first install it with brew install corepack, then run corepack enable. To uninstall an nvm installation, run brew uninstall nvm, remove the directory with rm -rf ~/.nvm, and delete the nvm lines from your ~/.zshrc; note that ~/.npmrc and globally installed packages remain.