Okay. Node.js install. First, let me say, I’m straight up copying steps from other places, BUT this is TOTALLY different because I’ve patched them all together in one spot for ease of use. Okay, enough funny business.
Here are the places I cribbed such wonderful instructions and Frankensteined them together:
- Dave McFarland’s How to Install Node.js and NPM on a Mac.
- How To Install Homebrew in Mac OS X El Capitan – Complete Guide.
- How to fix permission issues on Homebrew in OS X El Capitan?.
Deep breath. Here we go!
- Download and install Apple’s Xcode.
- Launch Xcode and agree to the terms. It may install some additional components. Once you agree, then you can close it.
- Open your Terminal app (located in Applications > Utilities > Terminal.
- Install Xcode’s command line tools:
- Reboot in “recovery mode” by restarting your computer and when you hear the start up chime, hold down the “command”+”R” keys until it fully reboots.
- Once in Recovery mode, open Utilities > Terminal and run “csrutil disable”. We are going to install Homebrew which needs permissions to the “/usr/local” directory, which Apple restricts.
- Reboot your computer!
- Reopen Terminal.
- Set permissions for ‘/usr/local’ by running…
sudo chown $(whoami):admin /usr/local && sudo chown -R $(whoami):admin /usr/local
- Reboot in “recovery mode” again.
- Once in Recovery mode, open Utilites > Terminal and run “csrutil enable” to make sure we reinstate Apple’s security measures.
- Reboot your computer
- Open Terminal and install Homebrew through the command line.
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
- Test if Homebrew installed correctly by running…
Install Node through the command line.
brew install node
- Test to see the node versions
- Create a test.js with some code in it.
console.log('I installed Node.js');
- Run it with node to prove your install works.
- You’re done. Woo hoo!