Posting this April 3rd, 2020. Working perfectly well for me.
I am using
skhd. To install
shpotify (command line interface for Spotify):
brew install shpotify
No need to worry about Spotify API if prompted - that is optional if you want to be able to choose tracks from the command line; play/pause, and volume settings work out of the box. Then installing
skhd (amazing shortcut manager for OSX):
brew install koekeishiya/formulae/skhd
brew services start skhd
Then head over to the file
~/.skhdrc which is the configuration file for
skhd and add the following:
fn - f8 : spotify pause
fn - f11 : spotify vol down
fn - f12 : spotify vol up
This will map your FN+Play/Pause, FN+Volume Up, and FN+Volume Down to Spotify specifically. Pressing any of those keys while Spotify is closed will automatically open it.
The added benefit of using this method is that you can control Spotify when it's playing both on your computer or an external device (i.e. Google Home), and allows more flexibility when pausing Spotify (i.e. when you open a video on the browser and OSX automatically maps the Play/Pause to the video as opposed to music playing in the background by Spotify).