# Installing Fast Node Manager (fnm)
# Why use fnm?
Fast Node Manager (fnm) (opens new window) is a fast and simple Node version manager built in Rust (opens new window).
For those of you who haven't read the post Installing Node Version Manager (nvm), a Node version manager allows you to easily install and switch between numerous versions of Node.js (opens new window). This is useful when a project youβre working on requires a different version of Node.js (opens new window) than what you currently have installed.
Here are some features of fnm (opens new window):
- Cross-platform, i.e., supports Linux, macOS, and Windows
- Single file, easy installation, and instant startup
- Significantly faster than Node Version Manager (nvm) (opens new window)
- Works with
.node-version
and.nvmrc
files
Since fnm (opens new window) is much faster than nvm (opens new window), it's my preferred way to manage my Node versions.
# Installation
We'll be going over how to install fnm (opens new window) on Linux, macOS, and Windows. If you run into any issues with installation then check out the fnm (opens new window) repository for any updates.
Other Installation Methods
If you're interested in using Cargo (opens new window) or downloading a release binary, then check out the fnm (opens new window) repository for installation instructions.
# Linux
First make sure you have curl
installed:
Next you can install fnm (opens new window) using either one of the following commands for bash
, zsh
, and fish
shells.
Here we're setting the custom directory $HOME/.local/bin
as the location to install fnm (opens new window) using --install-dir
.
If you want to install fnm (opens new window) in a different location, then change $HOME/.local/bin
to your preferred directory.
You can also remove --install-dir
when installing to use the default directory $HOME/.fnm
.
Run the following command if you don't have .local/bin
in your path and you're using the custom directory $HOME/.local/bin
.
If you're using a different custom directory and you don't have it in your path, then replace $HOME/.local/bin
with you're preferred directory.
Run the following command to upgrade fnm (opens new window).
If you're using a different custom directory, then replace $HOME/.local/bin
with you're preferred directory.
# macOS
The preferred way to install on macOS is to use Homebrew (opens new window):
Here's how to upgrade using Homebrew (opens new window):
# Windows
You can manually install on Windows using either Scoop (opens new window) or Chocolatey (opens new window):
# Shell Setup
Before you can use fnm (opens new window), you have to first set up your shell. We'll be going over how to set up fnm (opens new window) for bash
, zsh
, fish
, and powershell
.
Windows Command Prompt and Cmder
If you're interested in using Windows Command Prompt or Cmder then check out the fnm (opens new window) repository for instructions.
# Bash
Add the following to your .bashrc
:
# Zsh
Add the following to your .zshrc
:
# Fish Shell
Create ~/.config/fish/conf.d/fnm.fish
and add this line:
# PowerShell
Add this line to the end of your profile file:
On Windows, the profile is located at ~\Documents\PowerShell\Microsoft.PowerShell_profile.ps1
or $PROFILE
On macOS and Linux, the profile is located at ~/.config/powershell/Microsoft.PowerShell_profile.ps1
# Usage
Here are some useful commands to get started with fnm (opens new window). You can find more commands here (opens new window) or you can run fnm --help
to see a list of subcommands and fnm <SUBCOMMAND> --help
to see information for a specific subcommand.
# Completions
Here's how to set up fnm (opens new window) completions for bash
and zsh
:
# Bash
Add the following to your .bashrc
:
# Zsh
Add the following to your .zshrc
: