Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akhawaja/b25bf373284100fbe3c7 to your computer and use it in GitHub Desktop.
Save akhawaja/b25bf373284100fbe3c7 to your computer and use it in GitHub Desktop.

Install Node.js and NPM separately on OS X Yosemite

Install XCode

You can install XCode from the AppStore. Once done, install the XCode Command Line tools.

xcode-select --install

Install Homebrew

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Then check to make sure everything is installed correctly. brew doctor

Install Node

brew install node --without-npm

Change the prefix for the NPM packages

echo prefix=~/.node >> ~/.npmrc

Install NPM

curl -L https://www.npmjs.com/install.sh | sh

Add NPM to the user path

Edit your ~/.profile or ~/.bash_profile file and add the following line:

export PATH="$HOME/.node/bin:$PATH" # Add NPM to PATH for scripting

Then, reload your environment profile:

source ~/.bash_profile

Bonus: Install 'n' to manage different Node.js versions

npm install -g n

For more information on 'n', please see https://github.com/tj/n

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment