gpg-agent stopped working
I'm seeing exactly the same problem and, according to a MacPorts bug report, it's coming from libgpg-error and not seen with GnuPG version 2.1.16.

So it seems we need to either wait for the gnupg21 port to move from 2.1.15 to 2.1.16 or locally modify and rebuild the gnupg21 port (and maybe some of its dependencies?) to upgrade ahead of the official update. I'm not sure I'd want to do the latter with something like GnuPG though, although that's just an instinctive reaction.

Workaround

Rather than upgrading gnupg21 I've found that downgrading libgpg-error makes the problem go away (I tried this because of the comment in the GnuPG mailing list post linked from the bug report that it's the upgrade of libgpg-error from 1.24 to 1.25 that's caused the problem).

MacPorts provides guidance on downgrading a port and on one of my Macs I still happened to have 1.24 available (I installed MacPorts without root privileges hence the omission of sudo here):

$ port installed inactive | grep libgpg
  libgpg-error @1.24
$ port activate libgpg-error @1.24
---&gt;  Computing dependencies for libgpg-error
---&gt;  Deactivating libgpg-error @1.25_0
---&gt;  Cleaning libgpg-error
---&gt;  Activating libgpg-error @1.24_0
---&gt;  Cleaning libgpg-error
$ port installed inactive | grep libgpg
  libgpg-error @1.25
$ gpg2 -K

No error, much joy :)


It's not quite so straightforward if the older version has been removed but also works for me (and given the reference to linking errors it might be prudent to uninstall then reinstall gnupg21 after downgrading libgpg-error if using the method above) :

$ svn checkout -r 150579
https://svn.macports.org/repository/macports/trunk/dports/devel/libgpg-error
Error validating server certificate for 'https://svn.macports.org:443':
 - The certificate is not issued by a trusted authority. Use the
   fingerprint to validate the certificate manually!
Certificate information:
 - Hostname: *.macports.org
 - Valid: from Mar  2 07:47:38 2016 GMT until May  2 01:19:52 2017 GMT
 - Issuer: GlobalSign Domain Validation CA - SHA256 - G2, GlobalSign nv-sa, BE
 - Fingerprint: 3E:AF:D7:EA:81:A4:92:33:B6:BC:DA:38:76:C3:15:54:9A:09:50:E0
(R)eject, accept (t)emporarily or accept (p)ermanently? t
A    libgpg-error/files
A    libgpg-error/files/patch-configure.diff
A    libgpg-error/Portfile
Checked out revision 150579.
$ cd libgpg-error/
$ port install
---&gt;  Computing dependencies for libgpg-error
---&gt;  Fetching distfiles for libgpg-error
---&gt;  Verifying checksums for libgpg-error
---&gt;  Extracting libgpg-error
---&gt;  Applying patches to libgpg-error
---&gt;  Configuring libgpg-error
---&gt;  Building libgpg-error
---&gt;  Staging libgpg-error into destroot
---&gt;  Installing libgpg-error @1.24_0
---&gt;  Deactivating libgpg-error @1.25_0
---&gt;  Cleaning libgpg-error
---&gt;  Activating libgpg-error @1.24_0
---&gt;  Cleaning libgpg-error
---&gt;  Updating database of binaries
---&gt;  Scanning binaries for linking errors
---&gt;  Found 16 broken file(s), matching files to ports
---&gt;  Found 1 broken port(s), determining rebuild order
---&gt;  Rebuilding in order
     gnupg21 @2.1.15 +pinentry_mac
Portfile changed since last build; discarding previous state.
---&gt;  Computing dependencies for gnupg21
---&gt;  Cleaning gnupg21
---&gt;  Scanning binaries for linking errors
---&gt;  Found 16 broken file(s), matching files to ports
---&gt;  Found 1 broken port(s), determining rebuild order
---&gt;  Rebuilding in order
     gnupg21 @2.1.15 +pinentry_mac
---&gt;  Computing dependencies for gnupg21
---&gt;  Fetching distfiles for gnupg21
---&gt;  Verifying checksums for gnupg21
---&gt;  Extracting gnupg21
---&gt;  Configuring gnupg21
---&gt;  Building gnupg21
---&gt;  Staging gnupg21 into destroot
---&gt;  Deactivating gnupg21 @2.1.15_0+pinentry_mac
---&gt;  Cleaning gnupg21
---&gt;  Uninstalling gnupg21 @2.1.15_0+pinentry_mac
---&gt;  Cleaning gnupg21
---&gt;  Computing dependencies for gnupg21
---&gt;  Installing gnupg21 @2.1.15_0+pinentry_mac
---&gt;  Activating gnupg21 @2.1.15_0+pinentry_mac

GPG 2.1 uses a new format for its key files. Therefore you cannot use it together with any earlier version of GPG. Neither can you
easily go back to an older version as the old version cannot read the new format.

---&gt;  Cleaning gnupg21
---&gt;  Updating database of binaries
---&gt;  Scanning binaries for linking errors
---&gt;  No broken files found.