Whether you want to build web apps, run JavaScript outside the browser, or use AI coding tools like Claude Code, you’re going to need Node.js on your Mac. The good news: it’s not hard. The bad news: there are several ways to do it, and each one has its own quirks.
We’ll walk through three methods, from the most traditional to the easiest, so you can pick whichever one fits your situation.
Why do you need Node.js?
Before we get into the how, let’s cover the why. Node.js is a JavaScript runtime that lets you run JavaScript on your computer, not just in a web browser. You need it for:
- AI coding tools — Claude Code, Codex, and other AI assistants that run in your terminal are built on Node.js. You literally cannot install them without it.
- Web development — Most modern frameworks (Next.js, Astro, Nuxt, SvelteKit) require Node.js and its package manager, npm.
- Running scripts and automation — Build tools, task runners, linters, formatters — the entire JavaScript tooling ecosystem runs on Node.
- Building APIs and backends — Express, Fastify, and other server frameworks all need Node.js.
If you’re here because you tried to install an AI coding tool and got an error about Node.js not being found, you’re in the right place.
Method 1: The official installer from nodejs.org
This is the most straightforward approach. You download an installer, double-click it, and follow the prompts.
Step 1: Go to nodejs.org. You’ll see two download options: LTS (Long Term Support) and Current. Pick LTS. It’s the stable version and the one you want for almost every use case.
Step 2: Click the macOS installer. It will download a .pkg file.
Step 3: Double-click the .pkg file and follow the installation wizard. Click Continue a few times, agree to the license, and click Install. You’ll need to enter your Mac password.
Step 4: Once it finishes, open Terminal (press Cmd + Space, type “Terminal”, hit Enter) and verify the installation:
node --version
You should see something like v22.x.x. If you do, you’re good to go.
The downsides:
- No version management. The official installer puts one version of Node.js on your system. If you ever need a different version for a different project, you’re stuck uninstalling and reinstalling. Tools like
nvm(Node Version Manager) exist to solve this, but that’s another rabbit hole to go down. - Permissions issues. The installer puts Node.js in
/usr/local/, which can cause permission errors later when you try to install global npm packages. You might run into errors that tell you to usesudo, which is generally not great practice. - Manual updates. When a new version comes out, you have to go back to the website, download the new installer, and run through the whole process again.
For a quick, one-time installation, this method works fine. But if you’re planning to do serious development, read on.
Method 2: Homebrew
Homebrew is the unofficial package manager for macOS. If you’re comfortable in the terminal, this is probably the method you’ve seen recommended most often.
Step 1: Install Homebrew (if you don’t have it)
Open Terminal and paste:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
This will take a few minutes. It may also install Xcode Command Line Tools if you don’t already have them, which takes even longer.
Important for Apple Silicon Macs (M1/M2/M3/M4): After Homebrew installs, you may need to add it to your PATH. Homebrew will print instructions at the end of the install, but here’s what they usually look like:
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
If you skip this, your terminal won’t recognize the brew command even though you just installed it. This trips up almost everyone.
Step 2: Install Node.js
brew install node
That’s it. Homebrew installs both Node.js and npm (the Node package manager) together.
Step 3: Verify the installation:
node --version
npm --version
The downsides:
- Homebrew itself can be confusing to install. If you’ve never used a package manager, the steps above might already feel like a lot.
- PATH issues on Apple Silicon. As we mentioned, the extra PATH configuration step catches a lot of people off guard.
- Version management is limited. Homebrew installs the latest version. If you need to switch between versions, you’ll want something like
nvmorfnmon top of Homebrew, adding yet another tool to manage. - Updates can break things. Running
brew upgradecan bump Node.js to a new major version without warning, potentially breaking projects that depend on an older version.
Homebrew is a great choice if you’re already familiar with the terminal and plan to install other developer tools. If you’re mainly here because you need Node.js for AI coding tools, there’s an easier way.
Method 3: Vibestackr (the easy way)
If you’re installing Node.js specifically to use AI coding tools like Claude Code, Codex, or Gemini CLI, there’s a much simpler path. Vibestackr is a free Mac app that installs these tools with one click, and it handles Node.js automatically as part of the process.
Here’s how it works:
- Download Vibestackr (free)
- Open it and pick the AI coding tool you want (Claude Code, Codex, or Gemini CLI)
- Click Install
That’s the whole process. Vibestackr detects whether your system has Node.js and npm. If they’re missing, it installs them for you. It also handles PATH configuration, shell profile setup, and any other dependencies the tool needs. No terminal commands. No Homebrew prerequisite. No version conflicts.
You don’t need to know what Node.js is, or that it’s even involved. Vibestackr takes care of the plumbing so you can skip straight to the part where you’re actually building things.
Skip the setup
Download Vibestackr for free and get Node.js plus AI coding tools installed in one click.
Download for MacVerifying your Node.js installation
Regardless of which method you used, you should verify that Node.js is installed correctly. Open Terminal and run:
node --version
You should see a version number like v22.14.0 (or whatever the latest LTS is). Then check npm:
npm --version
You should see something like 10.x.x. If both commands return version numbers, you’re all set.
If you want to test that Node.js actually works, you can run a quick one-liner:
node -e "console.log('Node.js is working')"
If it prints Node.js is working, everything is configured correctly.
Troubleshooting common issues
”command not found: node”
This is the most common problem. It means your terminal can’t find the Node.js binary. A few things to try:
- Close and reopen Terminal. Some installations require a fresh terminal session to pick up PATH changes.
- Check your PATH. Run
echo $PATHand see if the directory containingnodeis listed. For Homebrew on Apple Silicon, that’s/opt/homebrew/bin. For the official installer, it’s/usr/local/bin. - Source your profile. Run
source ~/.zprofileorsource ~/.zshrcto reload your shell configuration without restarting Terminal.
”permission denied” or “EACCES” errors
This usually happens when you try to install global npm packages and don’t have write access to the directory where Node.js is installed. The official installer tends to cause this more than Homebrew.
The fix: don’t use sudo npm install -g. Instead, configure npm to use a directory you own:
mkdir -p ~/.npm-global
npm config set prefix '~/.npm-global'
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.zshrc
source ~/.zshrc
“npm: command not found” (but node works)
This is rare but can happen if something went wrong during installation. npm should be bundled with Node.js automatically. Try reinstalling Node.js using whichever method you originally used.
Node.js version is too old
Some tools require a minimum Node.js version. If you installed Node.js a while ago and never updated it, you might be running an older version. Check with node --version. If you need to update:
- Official installer: Download the latest LTS from nodejs.org and run the installer again.
- Homebrew: Run
brew upgrade node. - Vibestackr: Vibestackr checks for compatible versions automatically when installing tools.
Which method should you use?
Here’s the quick decision guide:
- Want Node.js for AI coding tools? Use Vibestackr. It installs Node.js and the AI tool in one step, and you don’t have to touch the terminal until you’re ready to start building.
- Already comfortable with the terminal? Homebrew is the standard choice for Mac developers. It makes updating easy and keeps things organized.
- Just want to get Node.js installed as fast as possible? The official installer from nodejs.org is a simple download-and-click process.
All three methods get you to the same place: a working Node.js installation on your Mac. The difference is how much friction you want to deal with along the way.
The fastest path from zero to building
Vibestackr installs Node.js, npm, and AI coding tools in one click. Free for Mac.
Download for Mac