Skip to content

Instantly share code, notes, and snippets.

Last active Sep 18, 2019
What would you like to do?
Simple script to generate a certificate used for local development on OSX
read -p 'Domain: ' DOMAIN
openssl req \
-newkey rsa:2048 \
-x509 \
-nodes \
-keyout "$DOMAIN".key \
-new \
-out $DOMAIN.crt \
-subj /CN="$DOMAIN" \
-reqexts SAN \
-extensions SAN \
-config <(cat /System/Library/OpenSSL/openssl.cnf \
<(printf "[SAN]\nsubjectAltName=DNS:$DOMAIN")) \
-sha256 \
-days 720
Copy link

daggerhart commented Feb 23, 2018

How to:

  1. ./
  2. (type in your desired domain)
  3. Open finder and double click the new .crt file. It should open in Keychain.
  4. Double click the new certificate, expand "Trust", set to "Always Trust"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment