Uninstall fnm on Ubuntu
This guide provides detailed instructions on how to completely uninstall fnm on Ubuntu systems.
Quick Uninstall
Using the Uninstall Script
bash
curl -fsSL https://fnm.vercel.app/uninstall | bashThis script will:
- Delete the fnm binary
- Clean up the
~/.fnmdirectory - Prompt you to remove fnm-related code from your Shell configuration
Manual Uninstall Steps
Step 1: Delete fnm Directory
bash
rm -rf ~/.fnmStep 2: Delete fnm Binary
Depending on the installation method, fnm may be located in different places:
bash
# If installed using curl script
rm -f ~/.fnm/fnm
# If manually installed to /usr/local/bin
sudo rm -f /usr/local/bin/fnm
# If installed using Homebrew
brew uninstall fnmStep 3: Clean Shell Configuration
Bash
Edit ~/.bashrc:
bash
nano ~/.bashrcRemove the following lines:
bash
eval "$(fnm env --use-on-cd)"
export PATH="$HOME/.fnm:$PATH"Reload:
bash
source ~/.bashrcZsh
Edit ~/.zshrc:
bash
nano ~/.zshrcRemove the following lines:
bash
eval "$(fnm env --use-on-cd)"
export PATH="$HOME/.fnm:$PATH"Reload:
bash
source ~/.zshrcStep 4: Clean Environment Variables
Check and clean related environment variables:
bash
# View current environment variables
env | grep FNM
# If there are leftovers, edit Shell configuration file to remove themfnm Installed via apt
If you installed fnm via apt:
bash
# Find package name
dpkg -l | grep fnm
# Uninstall
sudo apt remove fnm
sudo apt autoremovefnm Installed via Snap
If you installed via Snap:
bash
sudo snap remove fnmClean Node.js Versions
If you want to also delete Node.js versions managed by fnm:
bash
# Delete all Node.js versions
rm -rf ~/.fnm/node-versionsKeep Node.js Versions
If you want to keep installed Node.js versions:
bash
# Backup Node.js versions
cp -r ~/.fnm/node-versions ~/node-backup
# Or export to system path
sudo cp -r ~/.fnm/node-versions/v20.10.0/installation /usr/local/node20
sudo ln -s /usr/local/node20/bin/node /usr/local/bin/nodeVerify Uninstall
bash
# Should output "command not found"
fnm --version
# Check if directory is deleted
ls ~/.fnm
# Check if fnm is still in PATH
echo $PATH | grep fnmCommon Issues
Slow Shell Startup After Uninstall
Check if there's leftover code in Shell configuration files:
bash
grep -r "fnm" ~/.bashrc ~/.zshrc ~/.profile 2>/dev/nullnode Command Not Found
After uninstalling fnm, if there's no other Node.js installation:
bash
# Install system Node.js
sudo apt update
sudo apt install nodejs npm
# Or reinstall fnm
curl -fsSL https://fnm.vercel.app/install | bashPATH Issues
If there are still fnm-related paths in PATH:
bash
# Check PATH
echo $PATH
# Edit Shell configuration file to clean up
nano ~/.bashrc # or ~/.zshrcReinstall
If you need to reinstall fnm:
bash
curl -fsSL https://fnm.vercel.app/install | bash
# Configure Shell
echo 'eval "$(fnm env --use-on-cd)"' >> ~/.bashrc
source ~/.bashrcRelated Links
- Uninstall fnm - General uninstall guide
- Install fnm - Installation guide
- Linux Installation - Linux installation guide