Read this => How to Install Homebrew on macOS This tutorial will help you to install Node.js and NPM on the MacOS system using the Homebrew package manager.
Prerequisites
Before starting the installation of Node.js and NPM using this tutorial you must have the following prerequisites
Terminal: You must have Mac Terminal access and little knowledge about working with the terminal application. Ao login to your Mac system and open terminal Homebrew: Homebrew is a popular package manager for Mac operating systems. It is useful for installing most open-source software like Node
Install Node.js on MacOS
Let’s start the installation of Node.js on your Mac system using Homebrew. So first update the Homebrew package manager index. Then you can install the Node.js package in your MacOS system using the following command: You have successfully installed Node.js on your system. The default Node.js will be installed under the /usr/local/Cellar/node directory on your system. Now check and verify the installed version of Node.js, Execute the below command on the terminal. This will show you the installed version info. Also, find the installed version of NPM installed with Node.js. NPM is used for managing modules of Node.js on your system. The above output shows that you have installed Node.js version 18.7.0 and NPM 7.13.0 on your macOS system.
Upgrade Node.js on macOS
The newer versions of Node.js are released very frequently. You can use Homebrew to update Node on your system. Just execute the below commands to update the Homebrew index and then update Node.js.
Uninstall Node.js on macOS
You can simply use the Homebrew package manager to uninstall Node packages from your system. Just execute the below command from the terminal.