Once every year I make it a priority to nuke my Macbook Pro computer.
There are two reasons why I do this is to keep the apps I actually use, naturally removing the ones I no longer use, but don’t know that I no longer use them!
As I like to try new things it does mean I install lots of scripts and apps on my computer and because I might not actively remove these things from my computer when I no longer need them my computer gets bloated.
By nuking your computer frequently it helps to completely remove unused and unnecessary scripts and apps from your machine.
Knowing that I nuke my computer annually it helps to be more mindful of placing essential files on the cloud. There may come a day where my computer decides it doesn’t want a human to initiate the nuke, it wants to do it itself! When that happens all essential files still stored on my computer maybe lost forever.
This then has helped to structure my thinking into what to do with files as I am working on them. For example, if I’m writing a blog post I ensure I’ve already sent it to my private BitBucket repository, or if I’m working on a spreadsheet I store this in Google Drive or OneDrive.
It’s important then to make sure you are aware of the type of document you are handling and how this can be backed up if you’d like to keep it.
Moving on to our topic today, even though I nuked my computer 1 month ago, I’ve realised today I need to install NodeJS.
The problem I have with NodeJS is having it automatically update itself. I don’t want to have to re-install the direct downloadable file from NodeJS every time there’s a patch update.
Wouldn’t it be great to install it once, and when needed, run a command for it to automatically update?
Thankfully there is such an easy process: Homebrew for Mac
So here were the steps I undertook to be able to reinstall NodeJS back on to my computer:
Is NodeJS Already Installed?
Before you install
node you may want to check if you already have it installed. To check if
node is already on my machine run
node -v in your terminal. This simple command checks the version number of the currently installed node module on your computer.
$ node -v bash: node: command not found
If you have
node installed, you should see a version number pop up underneath your command. Great, there’s nothing more for you to do here! If though, you see the above, move on to the next step.
The quickest way to install NodeJS on your Mac is via Homebrew.
To install Homebrew check the latest instructions from their home page here.
Currently the command to run in terminal to install Homebrew is:
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
When you run this command from within your terminal window you may see some additional prompts, such as:
==> This script will install: /opt/homebrew/bin/brew /opt/homebrew/share/doc/homebrew /opt/homebrew/share/man/man1/brew.1 /opt/homebrew/share/zsh/site-functions/_brew /opt/homebrew/etc/bash_completion.d/brew /opt/homebrew ==> The following new directories will be created: /opt/homebrew/bin /opt/homebrew/etc /opt/homebrew/include /opt/homebrew/lib /opt/homebrew/sbin /opt/homebrew/share /opt/homebrew/var /opt/homebrew/opt /opt/homebrew/share/zsh /opt/homebrew/share/zsh/site-functions /opt/homebrew/var/homebrew /opt/homebrew/var/homebrew/linked /opt/homebrew/Cellar /opt/homebrew/Caskroom /opt/homebrew/Frameworks ==> The Xcode Command Line Tools will be installed. Press RETURN to continue or any other key to abort
To proceed with the installation of other necessary libraries that Homebrew needs, hit the RETURN key. If you see another prompt asking you to download XCode or XCode tools, then go into the App Store and install XCode first, before re-running the previous Homebrew installation script.
Finding available software Downloading Command Line Tools for Xcode Downloaded Command Line Tools for Xcode Installing Command Line Tools for Xcode Done with Command Line Tools for Xcode Done.
As Homebrew installs itself on your machine, you will see additional prompts on how things are progressing. Soon the installation would have finished and you may be prompted to perform some additional actions within the terminal.
==> Next steps: - Add Homebrew to your PATH in /Users/rds/.zprofile: echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/r/.zprofile eval "$(/opt/homebrew/bin/brew shellenv)" - Run `brew help` to get started - Further documentation: https://docs.brew.sh
Before installing node, let’s do a little housekeeping with Homebrew just to make sure our computer is updated and everything is in working order.
a) Check your system has the latest updates by running the command:
$ brew update
If you see
Already up-to-date then you’ve got the latest updates on your machine. If not, you would have noticed a bunch of modules updated on your system.
b) Check your system is humming along well with no conflicts by running
$ brew doctor Your system is ready to brew.
If you see
Your system is ready to brew then your computer is ready to proceed. If not, please read through any of the instructions provided on how you can correct your modules.
Install NodeJS With Homebrew
Our final step is to simply run the command
brew install node:
$ brew install node
You should see lots of action, and to check you’ve properly installed it, re-run our first command in terminal
$ node -v v14.2.0
Now you’re ready to use NodeJS.
Installing NodeJS is easily handled if done using the awesome package manager for Mac OS with Homebrew. While it main seem a little painful at first with all the extra installation of packages (etc), you will find as NodeJS upgrades their version it will be a lot easier to update with the help of Homebrew.