Secrets Using Keychain

Add a secret

security add-generic-password \
         -a ${USER} \
         -s $NAME \
         -w $VALUE

Delete Secret

security delete-generic-password -a ${USER} -s $1 >/dev/null

Retrieve Secret

security find-generic-password -a ${USER} -s $1 -w

Certificates

Get system root certificates.

security find-certificate \
         -a -p \
         /System/Library/Keychains/SystemRootCertificates.keychain \
         > ~/Documents/certs.pem
security find-certificate \
         -a -p \
         /Library/Keychains/System.keychain \
         >> ~/Documents/certs.pem

Temp Files

getconf DARWIN_USER_TEMP_DIR
#+RESULTS:
/var/folders/qh/z7vjfvbs1r38h5nrkby45wx80000gp/T/

Cache Files

getconf DARWIN_USER_CACHE_DIR
#+RESULTS:
/var/folders/qh/z7vjfvbs1r38h5nrkby45wx80000gp/C/