DEV Community

Vishnu
Vishnu

Posted on

Complete Remove/Uninstall node form mac OS

To remove Node.js from a Mac, follow these steps:

Uninstall Node.js using npm:

npm uninstall -g node
Enter fullscreen mode Exit fullscreen mode

Remove the Node.js executable and the npm modules:

 rm /usr/local/bin/node
 rm -rf /usr/local/lib/node_modules 
Enter fullscreen mode Exit fullscreen mode

Remove the Node.js home directory:

rm -rf ~/.npm
Enter fullscreen mode Exit fullscreen mode

Remove the npm and node directories from PATH:

vi ~/.bash_profile
Enter fullscreen mode Exit fullscreen mode

Search for and delete the following lines:

export PATH=$PATH:/usr/local/bin/npm
 export PATH=$PATH:/usr/local/bin/node
Enter fullscreen mode Exit fullscreen mode

Save and exit the file.

Restart the terminal or run the following command:

source ~/.bash_profile
Enter fullscreen mode Exit fullscreen mode

This should remove Node.js from your Mac. You can verify the uninstallation by running the following command:

node -v
Enter fullscreen mode Exit fullscreen mode

If Node.js is uninstalled, you should see an error message saying that the command is not found.

Remove NVM from MacOS

To remove nvm (Node Version Manager) from your Mac, follow these steps:

Remove the nvm installation directory:

rm -rf ~/.nvm
Enter fullscreen mode Exit fullscreen mode

Remove the nvm configuration from your shell profile:

vi ~/.bash_profile
Enter fullscreen mode Exit fullscreen mode

Search for and delete the following lines:

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
Enter fullscreen mode Exit fullscreen mode

Save and exit the file.

Restart the terminal or run the following command:

source ~/.bash_profile
Enter fullscreen mode Exit fullscreen mode

This should remove nvm from your Mac. You can verify the uninstallation by running the following command:

nvm -v
Enter fullscreen mode Exit fullscreen mode

If nvm is uninstalled, you should see an error message saying that the command is not found.

Top comments (0)