First make sure to go into an acocunt that allows priviledged access to sudo. In this case for me it's not my normal restricted user tin.pham account, but setup.admin,
su - setup.admin
And follow the install instructions at Homebrew.
Updating Homebrew may result in error if you do it in between Mac OS X updates,
brew update Error: The /usr/local directory is not writable. Even if this directory was writable when you installed Homebrew, other software may change permissions on this directory. For example, upgrading to OS X El Capitan has been known to do this. Some versions of the "InstantOn" component of Airfoil or running Cocktail cleanup/optimizations are known to do this as well. You should probably change the ownership and permissions of /usr/local back to your user account. sudo chown -R setup.admin:admin /usr/local/
In this in case using the chown is no longer possible with Mac OS X "High Sierra" 10.13.4 and you will receive the following error,
sudo chown -R setup.admin:admin /usr/local/ chown: /usr/local: Operation not permitted
Instead just uninstall,
Ignore the note about the folders to delete. I my example remotdesktop was generated by another program. No idea why Homebrew would tell you to delete folder other program's create.