Fun fact: if you don't want to put a command in history, prefix it with a space. This works in many shells.
setopt HIST_IGNORE_SPACE> setopt HIST_IGNORE_SPACE
Except that I think it's called `histignorespace` (I haven't caught up with when and how much zsh cares about lowercased names), I think this is just about zsh, not about macOS specifically.
HISTCONTROL=ignorespace