How to install Node.js and npm on a Mac using Homebrew

Step 1. Update Homebrew

Run

brew update

It is recommended that you always update Homebrew before installing new formulae. Homebrew will also try to update automatically every time you install new formulae, but you can disable that by setting HOMEBREW_NO_AUTO_UPDATE=1.

Step 2. Install Node.js

Run

brew install node

npm will be installed together with Node.js.

Step 3. Check your installation

Run

node

This will open the Node.js REPL. Execute a sample script, e.g.

function fib(n) {
    if (n < 3) {
        return 1
    }

    return fib(n - 1) + fib(n - 2)
}

fib(18)

See also

ellipsis IPA Transcription Poster
$14.99

A poster featuring the phonetic transcription of "ellipsis" in the International Phonetic Alphabet (IPA).

первоклассник Morphemic Analysis Poster
$14.99

A poster featuring the morphemic analysis of the Russian word первоклассник.

Big Chemical Structures
$29.99

A collection of elaborate, large-format chemical structure depictions. Discover the fine details of chemical structures in their own right.

Cylinder Poster, Solid Style, English-Labeled
$19.99

A poster featuring a cylinder.

Big Mongolian Words
$29.99

A collection of large-format Mongolian words.

OWL Functional Syntax Parse Tree Viewer

View the parse tree of OWL Functional Syntax.

JSmol

What is JSmol and how to use it?

OWL reasoning

Using OWL reasoning to infer new knowledge.

The building blocks of OWL

What makes up OWL ontologies and how do they support logical inference?

The RDF model of the Gene Ontology, demystified

An outline of the structure of the Gene Ontology RDF graph and ways to query it.

All prices listed are in United States Dollars (USD). Visual representations of products are intended for illustrative purposes. Actual products may exhibit variations in color, texture, or other characteristics inherent to the manufacturing process. The products' design and underlying technology are protected by applicable intellectual property laws. Unauthorized reproduction or distribution is prohibited.