How to Convert OpenType Font to Web Font

I needed to convert OpenType Font (OTF) to Web Font (WOFF2) and Roel Nieskens kindly showed me how using Bram Stein’s Homebrew web font tools. I want to write this down so I can remember how to do it later.

First, I needed to install Homebrew, which I pasted the following command at my Terminal prompt:

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

Then I ran these two commands

brew tap bramstein/webfonttools
brew install woff2

Then convert:

woff2_compress /directory/to/fontfile.otf

Magic!