3.2. List Certificates in a Mac OS Keychain

To find all certificates in keychain file /Library/Keychains/System.keychain with a nickname containing a given string, execute the commands below, replacing CA_CERT_NAME as needed.

CA_CERT_NAME='CA_CERT_NAME'

security \
    find-certificate \
    -a \
    -c "${CA_CERT_NAME}" \
    /Library/Keychains/System.keychain

To do the same but only show the nicknames, execute the commands below.

CA_CERT_NAME='CA_CERT_NAME'

security \
    find-certificate \
    -a \
    -c "${CA_CERT_NAME}" \
    /Library/Keychains/System.keychain |
grep '"alis"'