I am using zsh with oh-my-zsh on OSX. I installed gnupg2 from homebrew giving me the executable gpg2. Unfortunately zsh auto completion appears to only support gpg (even though that executable is not even installed). Is there a way to enable zsh auto completion for gpg2. Is there some sort of oh-my-zsh plugin for this?

  • Have you tried a symlink from gpg to gpg2?
    – rmelcer
    Mar 8, 2015 at 23:10
  • Yes that works. But it feels hackish to me. Is there a better way? Mar 8, 2015 at 23:11

1 Answer 1


Gpg 2.x has almost the same command line options as gpg 1.x, you're unlikely to encounter the very few options that have changed. So declare gpg2 as having the same completions as gpg. In your .zshrc, after the compinit line, add

compdef gpg2=gpg

If you have no compinit line (it may be somewhere deep in the bowels of oh-my-zsh), put this after the inclusion of oh-my-zsh components.

  • Works like a charm. For those using oh-my-zsh I would assume you have to place the line after source $ZSH/oh-my-zsh.sh Mar 8, 2015 at 23:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .