dist/platforms/darwin.js
/**
     * macOS is pretty simple - just add the certificate to the system keychain,
     * and most applications will delegate to that for determining trusted
     * certificates. Firefox, of course, does it's own thing. We can try to
     * automatically install the cert with Firefox if we can use certutil via the
     * `nss` Homebrew package, otherwise we go manual with user-facing prompts.
     */
macOS is pretty simple - just add the certificate to the system keychain,
and most applications will delegate to that for determining trusted
certificates. Firefox, of course, does it's own thing. We can try to
automatically install the cert with Firefox if we can use certutil via the
`nss` Homebrew package, otherwise we go manual with user-facing prompts.
macOS is pretty simple - just add the certificate to the system keychain and most applications will delegate to that for determining trusted certificates . Firefox of course does it ' s own thing . We can try to automatically install the cert with Firefox if we can use certutil via the ` nss ` Homebrew package otherwise we go manual with user - facing prompts .
addToTrustStores(certificatePath, options = {}) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            debug('Adding devcert root CA to macOS system keychain');
            utils_1.run(`sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain -p ssl -p basic "${certificatePath}"`);
            if (this.isFirefoxInstalled()) {
                debug('Firefox install detected. Adding devcert root CA to Firefox trust store');
                if (!this.isNSSInstalled()) {
                    if (!options.skipCertutilInstall) {
                        if (command_exists_1.sync('brew')) {
                            debug(`certutil is not already installed, but Homebrew is detected. Trying to install certutil via Homebrew...`);
                            utils_1.run('brew install nss');
                        }
                        else {
                            debug(`Homebrew isn't installed, so we can't try to install certutil. Falling back to manual certificate install`);
                            return yield shared_1.openCertificateInFirefox(this.FIREFOX_BIN_PATH, certificatePath);
                        }
                    }
                    else {
                        debug(`certutil is not already installed, and skipCertutilInstall is true, so we have to fall back to a manual install`);
                        return yield shared_1.openCertificateInFirefox(this.FIREFOX_BIN_PATH, certificatePath);
                    }
                }
                let certutilPath = path_1.default.join(utils_1.run('brew --prefix nss').toString().trim(), 'bin', 'certutil');
                yield shared_1.closeFirefox();
                yield shared_1.addCertificateToNSSCertDB(this.FIREFOX_NSS_DIR, certificatePath, certutilPath);
            }
            else {
                debug('Firefox does not appear to be installed, skipping Firefox-specific steps...');
            }
        });
    }
addToTrustStores ( certificatePath , options = { } ) { return tslib_1 . __awaiter ( this , void 0 , void 0 , function * ( ) { debug ( 'Adding devcert root CA to macOS system keychain' ) ; utils_1 . run ( ` ${ certificatePath } ` ) ; if ( this . isFirefoxInstalled ( ) ) { debug ( 'Firefox install detected. Adding devcert root CA to Firefox trust store' ) ; if ( ! this . isNSSInstalled ( ) ) { if ( ! options . skipCertutilInstall ) { if ( command_exists_1 . sync ( 'brew' ) ) { debug ( ` ` ) ; utils_1 . run ( 'brew install nss' ) ; } else { debug ( ` ` ) ; return yield shared_1 . openCertificateInFirefox ( this . FIREFOX_BIN_PATH , certificatePath ) ; } } else { debug ( ` ` ) ; return yield shared_1 . openCertificateInFirefox ( this . FIREFOX_BIN_PATH , certificatePath ) ; } } let certutilPath = path_1 . default . join ( utils_1 . run ( 'brew --prefix nss' ) . toString ( ) . trim ( ) , 'bin' , 'certutil' ) ; yield shared_1 . closeFirefox ( ) ; yield shared_1 . addCertificateToNSSCertDB ( this . FIREFOX_NSS_DIR , certificatePath , certutilPath ) ; } else { debug ( 'Firefox does not appear to be installed, skipping Firefox-specific steps...' ) ; } } ) ; }
macOS is pretty simple - just add the certificate to the system keychain,
 and most applications will delegate to that for determining trusted
 certificates.
macOS is pretty simple - just add the certificate to the system keychain and most applications will delegate to that for determining trusted certificates .
// Chrome, Safari, system utils // Try to use certutil to install the cert automatically