Go to MacOS Terminal
You can check out the Node installation in mac by using the below command. It will show node js version installed in your device.
# node -v
# v10.15.3
Open the terminal and enter the given below command to know your current directory.
# pwd
Go to your root directory.
# cd /
Then enter into the usr directory by using following command.
# cd usr
Go to locale directory.
# cd local
Enter into include folder by using given below command.
# cd include
Now if you enter the ls
command then you’ll see thenode folder
inside the include folder like given below.
# Digambers-MacBook-Pro:include digambersingh$ ls
# node
We have to remove this node folder to completely uninstall the Node js from MacOS.
# sudo rm -R node
Remove node_modules from MacOS
In next step we have to completely remove node_modules from our system.
Follow the steps
Enter the below command to go back to previous folder.
# cd ..
Go to lib directory, hit the below command to enter into the lib directory.
# cd lib
Use the below command to remove the node_modules (NPM) folder.
# sudo rm -R node_modules
Enter the below command to come out from the directory.
# cd ..
Go to bin folder using below command.
# cd bin
Here you also have to delete the node folder to uninstall the Node js completely.
Enter the below command to remove the Node js from MacOS.
# sudo rm -R node
Finally, we’ve successfully uninstalled the Node JS from MacOS, use the given below command to check whether the Node and NPM completely removed from our system.
# node -v
We have completed our task if you are getting below output.
# -bash: node: command not found