Shell Scripts in macOS Shortcuts
Automating tedium
I use the uBlacklist browser extension to block domains from search results (I went in depth on this topic previously). While it supports sync with Google Drive or Dropbox, I like to make things harder and refused to use those options, opting for a Git repo instead. Pushing the repo to a remote host like GitHub lets me subscribe to the rules.txt
file in all my browsers without needing to log in to anything, and other people can use my opinionated blacklist too.
My method of updating the list looked like this:
- Periodically open the uBlacklist settings page on all 3-5 browsers I have it installed on
- Open
rules.txt
in Vim (just because this is the one thing I use Vim regularly for) - Add a new line, and copy/paste the new additions from the browser extension
- Google how to quit Vim (just kidding, we use DuckDuckGo round these parts)
- Commit the changes to Git and push to remote
As much as I like playing escape room with Vim, this process is getting a little tedious after 5 months. I wrote a little shortcut in macOS to help streamline this:

Here’s what the shortcut does:
- Show a dialog titled, “Add rules from browser” with an input field
- Passes the text input to the standard input buffer (
stdin
) and runs some shell commands:- Change active directory to the folder my uBlacklist repo lives in
- Use
tee
to append the pasted text fromstdin
torules.txt
- Commit the changes to Git and push to remote
And here’s what my method of updating the list looks like now:
- Periodically open the uBlacklist settings page on all 3-5 browsers I have it installed on
- Run the shortcut
- Copy/paste the new additions from the browser extension
- Click “Done”

I only shaved off one step here, but it’s much less tedious. And I pinned the shortcut to my Menu Bar for easy access:

Now I want to make a shortcut for starting new blog posts with Hugo, similar to what Simone did with Jekyll.