Making locally-trusted development certificates.

Introduction

A simple zero-config tool to make locally trusted development certificates with any names you'd like.

Using certificates from real certificate authorities (CAs) for development can be dangerous or impossible (for hosts like example.test, localhost or 127.0.0.1), but self-signed certificates cause trust errors. Managing your own CA is the best solution, but usually involves arcane commands, specialized knowledge and manual steps.

mkcert automatically creates and installs a local CA in the system root store, and generates locally-trusted certificates. mkcert does not automatically configure servers to use the certificates, though, that's up to you.

mkcert install

Install guides

On macOS, use Homebrew to install mkcert.

$ brew install mkcert
$ brew install nss # if you use Firefox

Create a new certificate

mkcert 127.0.0.1 localhost dev.domain.com ::1

Mobile devices

For the certificates to be trusted on mobile devices, you will have to install the root CA. It's the rootCA.pem file in the folder printed by mkcert -CAROOT.

$ mkcert -CAROOT

It will show the path to the root CA. For example, /Users/username/Library/Application Support/mkcert.

On iOS, you can either use AirDrop, email the CA to yourself, or serve it from an HTTP server. After opening it, you need to install the profile in Settings > Profile Downloaded and then enable full trust in it.

For Android, you will have to install the CA and then enable user roots in the development build of your app. See this StackOverflow answer.

Using the root with Node.js

Node does not use the system root store, so it won't accept mkcert certificates automatically. Instead, you will have to set the NODE_EXTRA_CA_CERTS environment variable.

$ export NODE_EXTRA_CA_CERTS="$(mkcert -CAROOT)/rootCA.pem"

Community

We're excited to see the community adopt Hyperse-io, raise issues, and provide feedback. Whether it's a feature request, bug report, or a project to showcase, please get involved!