Documentation update for Mac
Trying to run this out of the box fails with
sed: illegal option -- u
The default sed used on Mac is BSD based and doesn't have any version info whatsoever. If you want to get this working on Mac, will need to use gnu-sed/gsed instead.

I myself see the following error
-bash: declare: -A: invalid option
I'm a little late to the party but like OP stated you will need the GNU version of sed and an updated version of bash. The sed -u flag lets the screen refresh faster by flushing the buffers faster and loading as little data into buffers (I believe). The declare -A flag allows you to declare associative arrays.
You'll need to run brew install bash and brew install gnu-sed in a command prompt. Then alter the script to use gsed that you just installed instead of sed that is pre-installed.
You may have to follow these instructions on setting up bash on OS X: Upgrading Bash on macOS