Skip to main content

Install NodeJS and NPM on Mac

Published: 2019-10-19

This will install node v10.16.3 and npm v6.9.0.

  1. Download tarball from NodeJS downloads

    curl -O -L https://nodejs.org/dist/v10.16.3/node-v10.16.3-darwin-x64.tar.gz
    
  2. Make dir then extract tarball

    mkdir -p ~/bin/nodejs
    tar -v -x -C ~/bin/nodejs -f node-v10.16.3-darwin-x64.tar.gz
    
  3. Set environment variables in your bash config file, e.g. ~/.bash_profile

    export NODEJS_HOME=$HOME/bin/nodejs/node-v10.16.3-darwin-x64
    export PATH=$NODEJS_HOME/bin:$PATH
    
  4. Source bash config file

    source ~/.bash_profile
    
  5. Confirm installation

    node --version
    npm --version