Things I Learned #11: Zsh, Spotify, and more

1 minute read til learning Comments

I've been using Zsh / Oh-My-Zsh for years, primarily on my Mac. If you're still using bash as your shell, you really should check it out.

There are times when I'm happily working in the terminal but want to do something simple like mute the music I'm listening to or turn up the volume. As I've discussed in previous posts, I'm also a fan of splitting my terminal windows into panes for different tasks. I also open Finder and preview images.

If only there was an easy, concise way to do all of those things...


I learned about the 'macos' plugin for Oh-My-Zsh that lets you do all of the above! Not only can I control Spotify (or Apple Music) from the terminal, I can quickly and easily open a folder in Finder or preview an image or split my terminal or...

Yes, this particular plugin does a lot, but let's start making sure it's enabled. In your .zshrc, add 'macos' to the list of plugins. The zshrc plugins section showing several plugins including macos. Once you've added the plugin, reload the config:

source ~/.zshrc

Once you've reloaded your config, you now have access to some new commands in your Zsh terminal. Want to open the current directory in a new terminal tab?

Want to create a vertical or horizontal pane?
vsplit_tab or split_tab
How about a shortcut to that Open command I wrote about in a previous post?
That will open Finder for the current folder.

Ok, enough of that - let's talk about Spotify integration.

The first time you run this, you'll be given some instructions to create a client id at the Spotify developer site and add it (and the client secret) to .shpotify.cfg. Once that's done you'll be able to do stuff like:
spotify vol up
spotify pause
spotify play artist "A Sound of Thunder"
Of course that last one needs to be followed by
spotify vol up

By the way, the Zsh plugin simply wraps Shpotify. If you don't want to use Zsh or it's plugin, you can simply install the script.

If you like great metal, check out A Sound of Thunder