#mac #terminal

Lately, I've been getting errors in my Laravel logs containing the following message:

[2023-03-15 09:25:18] local.ERROR: NSS_Init failed: security library: bad database.

I have no clue (yet) where this came from, but I was able to fix it by executing the following commands (thanks to StackOverflow):

$ mkdir -p ~/.pki/nssdb
$ chmod 700 ~/.pki/nssdb
$ certutil -d sql:$HOME/.pki/nssdb -N
Enter a password which will be used to encrypt your keys.
The password should be at least 8 characters long,
and should contain at least one non-alphabetic character.

Enter new password:
Re-enter password:
$ certutil -d sql:$HOME/.pki/nssdb -L

Certificate Nickname                                         Trust Attributes
                                                             SSL,S/MIME,JAR/XPI