Installation
1. Build from source
swift build -c release
Or use the setup script, which builds the binary, writes a wrapper script, and configures gpg-agent.conf for you:
./scripts/setup.sh
setup.sh:
- Runs
swift build -c release. - Verifies
$GNUPGHOME(default~/.gnupg) is owned by you and has0700permissions, fixing the mode if it’s wrong (and refusing to continue if the directory is owned by someone else). - Writes a plain wrapper to
$GNUPGHOME/scdaemon-se-wrapper.shthat justexecs the built binary (no debug logging — see Troubleshooting if you want a logging wrapper instead). - Appends
scdaemon-program <path-to-wrapper>togpg-agent.conf— or, if that file already has anscdaemon-programline, prints the line to add manually instead of overwriting your existing configuration.
2. Homebrew
Not live yet: the formula’s url/homepage point at github.com/gmarcusm/scdaemon-se, which does not exist as a public repository yet. brew install will fail with “repository not found” until it does. This section describes how installation will work once that repo is published.
brew tap gmarcusm/scdaemon-se https://github.com/gmarcusm/scdaemon-se
brew install scdaemon-se
The formula builds via swift build --disable-sandbox -c release and installs:
scdaemon-se— the daemon/CLI binaryscdaemon-se-inspect— read-only card/Keychain inspection (see CLI Reference)scdaemon-se-clear-enclave— removes scdaemon-se’s Keychain entries and (optionally) GPG shadow key stubs
It prints the exact gpg-agent.conf line to add as part of brew install’s caveats output.
3. Configure gpg-agent
If you didn’t use setup.sh or Homebrew, add the binary path to gpg-agent.conf yourself:
BINARY="$(swift build -c release --show-bin-path)/scdaemon-se"
echo "scdaemon-program $BINARY" >> ~/.gnupg/gpg-agent.conf
4. Restart gpg-agent
gpgconf --kill gpg-agent
The agent restarts automatically the next time GPG needs it.
5. Verify
gpg --card-status
You should see Secure Enclave Key as the display name and nistp256 as the key attributes for all three slots. Or, at the protocol level:
gpg-connect-agent "SCD SERIALNO" /bye
S SERIALNO D276000124010304<hex-serial>0000
OK
Uninstallation
- Remove the
scdaemon-programline from~/.gnupg/gpg-agent.conf. - Remove Secure Enclave keys and metadata from the Keychain:
./scripts/clear-secure-enclave.sh # dry run: lists what it would remove ./scripts/clear-secure-enclave.sh --yes # actually remove itBy default this only prints the plan (every specific Keychain item it found, by name) and deletes nothing;
--yesis required to act. Add--shadow-stubsto also remove scdaemon-se’s own GPG shadow stubs from~/.gnupg/private-keys-v1.d/— off by default. Stubs are matched by keygrip against the key-pin store, so another card’s stubs (e.g. a YubiKey’s) are identified and never touched. It also restarts gpg-agent. To remove one additional signing card instead of everything, usescdaemon-se --remove-card <serial> --yes(see CLI Reference). - Remove the public key from your keyring if you no longer want it:
gpg --delete-keys <email-or-fingerprint> - Restart gpg-agent:
gpgconf --kill gpg-agent