Setup GPG on macOS

Install

brew install gpg

Create new key

gpg –full-generate-key

Setup keychain

gpg collects password from cli. This causes issues if using vscode to create a commit. So input can be taken from a popup …


This content originally appeared on DEV Community and was authored by Soham Zemse

Install

brew install gpg

Create new key

gpg --full-generate-key

Setup keychain

gpg collects password from cli. This causes issues if using vscode to create a commit. So input can be taken from a popup or keychain.

brew install pinentry-mac

The brew installation will print these caveats:

==> Caveats
You can now set this as your pinentry program like

~/.gnupg/gpg-agent.conf
    pinentry-program /opt/homebrew/bin/pinentry-mac

So just create a ~/.gnupg/gpg-agent.conf file if it doesn't exist and put the line pinentry-program /opt/homebrew/bin/pinentry-mac in it.

Now, to check if it works.

1.gpg --list-keys to print the existing keys.

  1. pkill -TERM gpg-agent.
  2. Restart the terminal.
  3. echo test | gpg -e -r <PUT THE KEY ID HERE> | gpg -d

This should open a pin entry popup and make sure "save in keychain" option is selected.

More links

Documentation on GitHub for setup: https://docs.github.com/en/authentication/managing-commit-signature-verification


This content originally appeared on DEV Community and was authored by Soham Zemse


Print Share Comment Cite Upload Translate Updates
APA

Soham Zemse | Sciencx (2023-03-12T14:07:08+00:00) Setup GPG on macOS. Retrieved from https://www.scien.cx/2023/03/12/setup-gpg-on-macos/

MLA
" » Setup GPG on macOS." Soham Zemse | Sciencx - Sunday March 12, 2023, https://www.scien.cx/2023/03/12/setup-gpg-on-macos/
HARVARD
Soham Zemse | Sciencx Sunday March 12, 2023 » Setup GPG on macOS., viewed ,<https://www.scien.cx/2023/03/12/setup-gpg-on-macos/>
VANCOUVER
Soham Zemse | Sciencx - » Setup GPG on macOS. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2023/03/12/setup-gpg-on-macos/
CHICAGO
" » Setup GPG on macOS." Soham Zemse | Sciencx - Accessed . https://www.scien.cx/2023/03/12/setup-gpg-on-macos/
IEEE
" » Setup GPG on macOS." Soham Zemse | Sciencx [Online]. Available: https://www.scien.cx/2023/03/12/setup-gpg-on-macos/. [Accessed: ]
rf:citation
» Setup GPG on macOS | Soham Zemse | Sciencx | https://www.scien.cx/2023/03/12/setup-gpg-on-macos/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.