Install ykman:

brew install ykman

Configure your 2 slot for static password:

ykman otp static 2 --keyboard-layout US

The --keyboard-layout US is to prevent getting Error: Unsupported character: xxx

🔗reset pin

To reset all data:

$ ykman piv reset
WARNING! This will delete all stored PIV data and restore factory settings. Proceed? [y/N]: y
Resetting PIV data...
Success! All PIV data have been cleared from the YubiKey.
Your YubiKey now has the default PIN, PUK and Management Key:
        PIN:    123456
        PUK:    12345678
        Management Key: 010203040506070801020304050607080102030405060708

Change the PIN now:

ykman piv change-pin

Change the PUK

ykman piv change-puk

Generate a random management key and store it on the device, protected with the PIN.

ykman piv change-management-key --generate --protect

🔗GPG

To reset all GPG data:

ykman openpgp reset

Set the Admin and pin using:

$ gpg --edit-card
gpg/card> admin
Admin commands are allowed

gpg/card>passwd

To use the key in another sytem just import the public key and trust it:

$ curl -sSL https://github.com/nbari.gpg | gpg --import
$ gpg --edit-key [email protected]
trust
5
save

https://developers.yubico.com/PGP/Importing_keys.html