In this tutorial, we will show you 3 methods to uninstall Node.js from Mac OS system.
How to Uninstall Node.js on a Mac?
Here are the 3 methods:
Method 1: Uninstall Node.js using Terminal
One of the easiest and quickest ways to uninstall Node.js from your Mac is by using the Terminal app, Here are the steps for that:
Step 1: Open the Terminal app on your Mac.
Step 2: Type the following command and press Enter to see the version of Node.js that is installed on your Mac:
node -v
Step 3: Type the following command to uninstall Node.js:
sudo rm -rf /usr/local/{bin/{node,npm},lib/node_modules/npm,lib/node,share/man/man1/node.1}
Step 4: Press Enter and enter your password when prompted.
Step 5: Type the following command and press Enter to verify that Node.js has been uninstalled:
node -v
Method 2: Uninstall Node.js using Homebrew
If you installed Node.js on your Mac using Homebrew, you can uninstall it using Homebrew as well, Here are the steps for that:
Step 1: Open the Terminal app on your Mac.
Step 2: Type the following command to uninstall Node.js:
brew uninstall node
Step 3: Press Enter and wait for the uninstallation process to complete.
Step 4: Type the following command and press Enter to verify that Node.js has been uninstalled:
node -v
Method 3: Uninstall Node.js using Node Version Manager (NVM)
You can uninstall node js using NVM, Here are steps:
Step 1: Open the Terminal app on your Mac.
Step 2: Type the following command to list the installed versions of Node.js:
nvm ls
Step 3: Type the following command to uninstall a specific version of Node.js:
nvm uninstall <version>
Replace <version>
with the version of Node.js that you want to uninstall.
Step 4: Repeat Step 3 for each version of Node.js that you want to uninstall.
Step 5: Type the following command to verify that Node.js has been uninstalled:
node -v
Conclusion
In conclusion, we have learned 3 methods to remove node js from mac os completely.