Fix for GPG on the Mac

No longer need the GPG Suite of tools just to open an encrypted file.
This commit is contained in:
Howard Abrams 2022-05-10 11:27:31 -07:00
parent 8603f538c2
commit d43532631d

View file

@ -112,16 +112,21 @@ On Linux, GPG is pretty straight-forward, but on the Mac, I often have troubles
#+BEGIN_SRC sh #+BEGIN_SRC sh
brew install gpg brew install gpg
#+END_SRC #+END_SRC
And I need to install the [[https://gpgtools.org/][GPG Suite]]. While very nice, isn't a GUI I really need, but can take advantage when installed: Next, on every reboot, start the agent:
#+BEGIN_SRC sh
/usr/local/Cellar/gnupg/2.3.6/bin/gpg-agent --daemon
#+END_SRC
The only issue is that =brew link gpg= doesnt always work, so maybe a helper function to find the executable:
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(defun executable (path) (defun executable (path)
"Return PATH if it is executable, see `file-executable-p'." "Return PATH if it is executable, see `file-executable-p'."
(when (file-executable-p path) path)) (let ((epath (first (file-expand-wildcards path))))
(when (file-executable-p epath) epath)))
(use-package epa-file (use-package epa-file
:straight (:type built-in) :straight (:type built-in)
:custom (epg-gpg-program (or (executable "/usr/local/MacGPG2/bin/gpg") :custom (epg-gpg-program (or (executable "/usr/local/Cellar/gnupg/*/bin/gpg")
(executable "/usr/local/bin/gpg") (executable "/usr/local/bin/gpg")
(executable "/usr/local/opt/gpg") (executable "/usr/local/opt/gpg")
(executable "/usr/bin/pgp"))) (executable "/usr/bin/pgp")))