- Open the command line
- Copy the folling command in and press enter
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.32.1/install.sh | bashThis will create the directory ~/.nvm and install nvm into it
- run
ls -a ~/and look for the .nvm directory
- Run the command
touch ~/.bashrc ~/.bash_profile
This will make sure the files ~/.bashrc and ~/.bash_profile exist - Open the
~/.bash_profileand~/.bashrcfiles in your text editor - Add the following lines to the end of your ~/.bash_profile
# Read $HOME/.bashrc, if present.
if [ -f $HOME/.bashrc ]; then
source $HOME/.bashrc
fi- Add the following lines to the end of your ~/.bashrc
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvmThe Bash configuration files are loaded by bash at different times. We edit them both to ensure node will allways be setup.
- ~/.bash_profile is the personal initialization file, executed for login shells
- on OSX this runs every time you open a new terminal window
- on Linux this runs every time you login to your computer
- ~/.bashrc is the individual per-interactive-shell startup file
- on OSX this runs every time you type the command
bash - on Linux this runs every time you open a terminal or type the command
bash - run
source ~/.bashrcto load the new configuration - run
command -v nvmto verify that nvm is installed (it should output "nvm")
- run the command
nvm install 6
this will install the latest version of node 6 - Open ~/.bashrc in your text editor
- Add the following line to the end of your ~/.bashrc to configure nvm to use NodeJS version 6
nvm use 6- run
node -vto verify NodeJS v6 is installed (it should output "v6.x.x")