The solution from @Developer Tools Engineer, @robnapier and @stragerneds did not work for me. I'm still getting "Failed to gain authorization", even after adding the entitlement. I'm debugging a plain executable.
codesign -dvvv --entitlements=- /Users/ccleve/.pgrx/16.0/pgrx-install/bin/psq```
l
Executable=/Users/ccleve/.pgrx/16.0/pgrx-install/bin/psql
Identifier=psql-55554944e8e26ef3f50637679e1c2d5ded7430a8
Format=Mach-O thin (arm64)
CodeDirectory v=20400 size=6342 flags=0x2(adhoc) hashes=187+7 location=embedded
Hash type=sha256 size=32
CandidateCDHash sha256=1b033acfe360f3efe957c00c5b0436bb2e686d61
CandidateCDHashFull sha256=1b033acfe360f3efe957c00c5b0436bb2e686d61c71347c05bc36fb2c653fae2
Hash choices=sha256
CMSDigest=1b033acfe360f3efe957c00c5b0436bb2e686d61c71347c05bc36fb2c653fae2
CMSDigestType=2
Launch Constraints:
None
CDHash=1b033acfe360f3efe957c00c5b0436bb2e686d61
Signature=adhoc
Info.plist=not bound
TeamIdentifier=not set
Sealed Resources=none
Internal requirements count=0 size=12
[Dict]
[Key] com.apple.security.get-task-allow
[Value]
[Bool] true
(Not sure how to get the above output to format correctly.)