Skip to content

Instantly share code, notes, and snippets.

@asgh
asgh / macos-certificates-to-java-keystore.sh
Last active January 17, 2024 09:46 — forked from LukeDefeo/macos-certificates-to-java-keystore.sh
Extracts all certificates from the mac os certificate store / key chain and imports them into the key chain of your Java installation
#!/bin/bash
#this script should pull all root CAs from the mac os keychain and add them to the jre's keystore
#Comes with absolutely no warranty and all the usual disclaimers
mkdir temp-extract
cd temp-extract
keystore=`/usr/libexec/java_home`/jre/lib/security/cacerts
echo "making backup of keystore $keystore to ~/keystore.backup"
set -e -o pipefail