Skip to content

Instantly share code, notes, and snippets.

@K3TH3R
Last active December 28, 2015 10:20
Show Gist options
  • Save K3TH3R/7593ec671e299c446f81 to your computer and use it in GitHub Desktop.
Save K3TH3R/7593ec671e299c446f81 to your computer and use it in GitHub Desktop.
Installing NVM with automatic node version switching on `cd` into a directory for Mac OS X
  1. Install Command Line Tools (and install Xcode from Apple's Developer site - developer.apple.com) xcode-select --install (or download from Apple’s Developer site)

  2. Install Node Version Manager:
    curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.30.0/install.sh | bash and make sure you add the following to your .bash_profile: source ~/.nvm/nvm.sh

  3. Install Node version 4, as well as any other versions you want to use. See Usage for directions on using NVM: nvm install 4

  4. Make sure you alias NVM's default to 4: nvm alias default 4

  5. Install global Node utilities:
    npm install -g avn avn-nvm avn-n and then setup AVN: avn setup NOTE: You should do this step every time you add a new version of Node to NVM

  6. Add .node-version file (like the one attached) to every project directory where your node_modules directory resides. This will tell NVM to switch to whatever Node version is in this file as soon as you cd into the directory.

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