Installing FNM on Your Mac

FNM (Fast Node Manager) explained and how to get started.

🌱 Created: 11/11/2021

✏️ Updated: 31/07/2022

Author: Dante Mogrim


"What is FNM and why should I install it?" You might have heard of something called NVM (short for Node Version Manager). FNM (short for Fast Node Manager) is, as you might have guessed, said to be an ~40x faster alternative. It is built in Rust and comes with cross-platform support.

📋 Necessities

🙇‍♂️ Heads up! I cleared all my prior Node.js installations to be able to use FNM as my sole Node.js provider. If you want to do this as well, run the following two commands, otherwise skip ahead to "Installation":

$ brew uninstall --ignore-dependencies node
$ brew uninstall --force node

Installation

Start by opening up your terminal and running the following command:

$ brew install fnm

The process from here varies depending on your shell. If your using something other than fish, I recommend looking into this part of the documentation for this following step.

If you're like me and your using fish, run the following command in your terminal:

$ touch ~/.config/fish/conf.d/fnm.fish

Now we've created a configuration file for FNM within our shell. We need to add a specific line inside it for it to work properly with FNM. I like to handle things visually, so let's open it up and add the line from VSCode. Type the following commands:

$ cd ~/.config/fish/conf.d/
$ code .

Now we have our file open in VSCode. Just add and save the following line in the fnm.fish file:

$ fnm env | source

Usage

For more in depth examples there's documentation available but here are some for getting started:

Print the Node.js version that's currently in use:

$ fnm current
// Output: * system (In my case, empty.)

List all node versions that are available to download:

$ fnm list-remote

For me to install the (currently) latest version of Node.js I'll be running the following command:

$ fnm install v17.1.0

Other versions of node that might be nice to alternate between:

$ fnm install v11.0.0
$ fnm install v16.9.1

To switch to 16.9.1:

$ fnm use v16.9.1

👆 Note! This will only last during the current session! If you want to use 16.9.1 during a longer period of time, I would recommend switching it to your default and then switching back the latest version, once your finished.

To switch your default to 16.9.1:

$ fnm default v16.9.1
$ fnm current
// Output: v16.9.1

See what versions of node that are currently installed on your computer:

$ fnm list
// Output:
// v11.0.0
// v16.9.1 default
// v17.1.0
// * system

Other useful commands:

To see which version of FNM that's installed:

$ fnm --version
// Mine is currently 1.28.1

Help menu:

$ fnm help

Hope this was helpful in getting started!

It can sometimes be a time saver to be able to switch between different Node.js versions when trying to access old projects or newer ones. If you have any questions or comments, get in touch.