fnm
Install
Run curl -fsSL https://fnm.vercel.app/install | bash. It installs with Homebrew. It says:
Installing for Zsh. Appending the following to /Users/albert/.zshrc:
# fnm
FNM_PATH="/Users/albert/Library/Application Support/fnm"
if [ -d "$FNM_PATH" ]; then
export PATH="/Users/albert/Library/Application Support/fnm:$PATH"
eval "`fnm env`"
fi
In order to apply the changes, open a new terminal or run the following command:
source /Users/albert/.zshrc
The install script adds the following to ~/.zshrc:
# fnm
FNM_PATH="/Users/albert/Library/Application Support/fnm"
if [ -d "$FNM_PATH" ]; then
export PATH="/Users/albert/Library/Application Support/fnm:$PATH"
eval "`fnm env`"
fi
But it doesn't work. I've had to replace it with eval "$(fnm env --shell zsh)" or eval "$(fnm env --use-on-cd --shell zsh)".
At https://nodejs.org/en/download it says:
# Download and install fnm:
curl -o- https://fnm.vercel.app/install | bash
# Download and install Node.js:
fnm install 22
# Verify the Node.js version:
node -v # Should print "v22.16.0".
# Verify npm version:
npm -v # Should print "10.9.2".
Upgrade
Upgrade using Homebrew (brew upgrade).