Forrest logo
back to the security tool

security:tldr:5ba16

security: Set a certificate to use with a website or [s]ervice by its [c]ommon name (fails if several certificates with the same common name exist).
$ security set-identity-preference -s ${select} -c "${common_name}" ${filename-keychain}
try on your machine

The security set-identity-preference command is used to set the preferred digital identity (certificate) for a specific purpose on macOS.

Here is the breakdown of the command:

  • -s ${select}: The -s flag indicates the item to be set. ${select} is a placeholder for the specific item being set. It could be a purpose like "ssl" or "codesigning", indicating the purpose for which the identity will be used.

  • -c "${common_name}": The -c flag sets the common name for the identity. ${common_name} is a placeholder for the actual common name of the identity. The common name is a human-readable name associated with the identity.

  • ${filename-keychain}: This specifies the filename of the keychain where the identity is located. The ${filename-keychain} is a placeholder for the actual filename.

Overall, this command sets the preferred identity for a specific purpose by specifying the purpose, common name, and keychain filename.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the security tool