It is now easier than ever to get Node Version Manager up and running on Mac OSX using Homebrew. I have previously blogged about setting up Homebrew on Mac OSX, and setting up NodeJS with NVM on Mac OSX. However now things are even easier.
Once you have Homebrew up and running on your mac now you can simply open your terminal window and execute the following commands :
[pastacode manual=”%24%20brew%20install%20nvm” provider=”manual” lang=”sh”/]
This will install Node Version manager. There is one glitch at the time of writing, which may be resolved in a package update later.
I did need to create a
./bash_profile in order for my settings to be remembered across terminal sessions. To do this I simply fired up
nano and entered in some details.
[pastacode manual=”%24%20sudo%20nano%20~%2F.bash_profile%0D%0A%0D%0A” provider=”manual” lang=”default”/]
Once I had the text editor open I provided these following details
[pastacode manual=”export%20NVM_DIR%3D%22%24HOME%2F.nvm%22%0D%0A%20%20.%20%22%24(brew%20–prefix%20nvm)%2Fnvm.sh%22″ provider=”manual” lang=”sh”/]
Saved the file then ensured that terminal picked this up every time it ran by :
[pastacode manual=”source%20~%2F.bash_profile” provider=”manual” lang=”default”/]
Once complete I could install as many versions of NodeJS as required and I even installed the latest Version 6.
[pastacode manual=”nvm%20install%206.9.2%0D%0Anvm%20install%205.7.0%0D%0Anvm%20install%205.5.0%0D%0Anvm%20install%205.3.0%0D%0Anvm%20install%204.2.0%0D%0Anvm%20install%200.12″ provider=”manual” lang=”default”/]
Once you have all the versions of node you need. It is easy enough to switch between the different versions
[pastacode manual=”%20nvm%20use%206.9.2″ provider=”manual” lang=”default”/]
You can check which version of node is actually currently in use, by either
[pastacode manual=”%20nvm%20current” provider=”manual” lang=”default”/]
or simply using
[pastacode manual=”node%20-v%20″ provider=”manual” lang=”default”/]
A unique background as business owner, marketing, software development and business development ensures that he can offer the optimum business consultancy services across a wide spectrum of business challenges.
Latest posts by Gary Woodfine (see all)
- OAuth2 Server with Laravel Passport - June 18, 2019
- Access Vagrant mySQL database from PhpStorm - June 17, 2019
- How to use a Material Design Component Framework with Vue - June 13, 2019