Skip to content

Instantly share code, notes, and snippets.

@kulas
Last active April 6, 2021 16:27
Show Gist options
  • Save kulas/ac630cae98000c33ca35d77ba7a78223 to your computer and use it in GitHub Desktop.
Save kulas/ac630cae98000c33ca35d77ba7a78223 to your computer and use it in GitHub Desktop.
Install and Maintain Front-End Tools with Homebrew on OS X, also Git, Node, Gulp, and Bower

Install & Maintain Front-End Tools

All commands assume you are at the prompt. The prompt seperator “$” has been ommited.

Install Xcode Command Line Tools

Download Xcode from App Store. then open Xcode and select the following. As of Xcode 8.2 the Developer Tools are installed automatically.

Preferences > Downloads > Command Line Tools

Install Homebrew

Homebrew makes installing programs and packages insanely easy on a Mac. Open Terminal and type the following, then follow the steps it gives you.

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Install Git

See Install Git from Atlassian’s Become a Git Guru for more details and other installations.

Apple includes their own fork of Git in the Xcode Developer Tools, but it tends to lag behind mainstream Git by several major versions. You may want to install a newer version of Git using one of the methods below.

Git for Mac Installer

  1. Download the latest [Git for Mac installer] (https://sourceforge.net/projects/git-osx-installer/files/)
  2. Follow the prompts
  3. Open a terminal and verify the installation was successful git --version
  4. Configure your Git username and email using the following commands, replacing “Your Name” name with your own. These details will be associated with any commits that you create:
git config --global user.name "Your Name"
git config --global user.email "[email protected]"

Install Git with Homebrew

  1. Open your terminal and install Git using Homebrew brew install git
  2. Configure your Git user name as detailed above.
  3. Verify the installation was successful git --version

Install Node Globally

We’ll use Node Version Manager and install with Homebrew. See: https://tecadmin.net/install-nvm-macos-with-homebrew/

We’ll use Homebrew to install Node.js, which is the server-side JavaScript environment that Gulp runs in. Node.js comes with npm, the Node Package Manager. Run a command to install Node globally:

brew install node

Install Gulp Globally

This will install the Gulp command line, globally. Run this command to install Gulp globally:

npm install --global gulp-cli

Install Bower Globally

This is the last global step before we start installing things locally—on a per project basis. Run this command to install Bower globally:

npm install -g bower

Install Yarn Globally

If Node is already installed, install Yarn on its own

brew install yarn --without-node

brew install yarn --ignore-dependencies

Install Node, Gulp, and Bower to Local Project Folder

Run a command to install Node and Gulp to the local project folder:

npm install

Run a command to install Bower. Be sure you are installing in the correct location. The bower.json file must be present. If this is a WordPress project, there is a good chance that these components will need to be installed into the specific theme you are working on.

bower install


Update Tools

If it has been awhile since your last commit you may need to update your tools.

Check the versions of your tools:

node -v

npm -v

gulp -v

bower -v

yarn -v

Update Homebrew with the following commands:

brew doctor

brew update

Update Node globally and NPM with the following commands:

brew upgrade node

npm update This updates all local packages.

Node comes with NPM installed so you should have a version of NPM. However, NPM gets updated more frequently than Node does, so you’ll want to make sure it’s the latest version.

Update NPM globally with the following command:

npm install npm@latest -g

Update Yarn

brew upgrade yarn

Update Gulp globally...

If you’ve previously installed Gulp globally, use the following command to remove Gulp first:

npm rm --global gulp

Then reinstall the Gulp commandline interface globally with the following command:

npm install --global gulp-cli

Yes, it is confusing. You can’t simply update Gulp globally. Read the Gulp documentation for a more detailed explination of this rational.


Update Local Project Dependencies

Find newer versions of package dependencies than what your package.json or bower.json allows. Install NPM Check Updates.

Where was that tool installed?

Need to know the location of Node, NPM, Gulp, or Bower? The following commands will print out the path to the installation.

which node

which npm

which gulp

which bower


Further Reading

(How to update out of date package.json)[https://www.themarketingtechnologist.co/how-to-update-an-out-of-date-package-json/]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment