Node.js 20.x offers significant improvements, and installing it on macOS, especially with Apple Silicon processors like M1, M2, or M3, ensures optimal performance. Here’s how to get started.
Step 1: Install NVM (Node Version Manager)
To manage Node.js versions easily, start by installing NVM:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash
After installation, restart your terminal.
Step 2: Install Node.js
Using NVM, install Node.js 20.x:
nvm install 20
This ensures Node.js is correctly set up for your environment.
Step 3: Verify the Installation
Verify that the correct version of Node.js and npm are installed:
node -v
npm -v
You should see Node.js v20.16.0
and npm v10.8.1
.
Alternative: Using Homebrew
If you prefer Homebrew, ensure it’s installed, then run:
brew install node@20
Additional Notes for Apple Silicon Users
macOS on Apple Silicon (M1, M2, M3) is fully supported. NVM and Homebrew seamlessly handle the architecture differences, making the installation process straightforward.
For those running Ubuntu, you can follow my comprehensive guide for installing Node.js 20.x on Ubuntu 24.04 LTS.
This method ensures your macOS system is ready for modern Node.js development, regardless of your processor architecture. Happy coding!