Node Version Manager (nvm
) greatly simplifies the management of Node.js versions, their installation, and removes the need for sudo
when dealing with packages (e.g. npm install ...
). Fish Shell (fish
) "is a smart and user-friendly command line
shell for OS X, Linux, and the rest of the family" that is a popular alternative among programmers to common shells such as bash
. Lastly, Oh My Fish (omf
) allows for customizing and installing packages within Fish shell.
This guide assumes you are already using Fish as your shell.
Install nvm
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.4/install.sh | bash
Install Oh My Fish
curl -L https://github.com/oh-my-fish/oh-my-fish/raw/master/bin/install | fish
(Note: You will be prompted to restart your terminal at this point. Go ahead and do so now.)
Install plugin-nvm for Oh My Fish
We will install plugin-nvm via Oh My Fish to expose nvm
capabilities within the Fish shell:
omf install nvm
Install Node.js with Node Version Manager
You are now ready to use nvm
. You may install and use the version of Node.js of your liking. Some examples:
nvm install node
nvm install 6.3.1
nvm ls
nvm use 4.3.1
Final Notes
Remember again, that we no longer need sudo
when dealing with Node.js using this method! Node versions, packages, and so on are installed in your home directory.