{"id":632,"date":"2021-04-02T17:31:17","date_gmt":"2021-04-02T17:31:17","guid":{"rendered":"https:\/\/localwp.com\/?post_type=help&#038;p=632"},"modified":"2024-01-22T20:54:12","modified_gmt":"2024-01-22T20:54:12","slug":"managing-local-sites-ssl-certificate-in-macos","status":"publish","type":"help","link":"https:\/\/localwp.com\/help-docs\/getting-started\/managing-local-sites-ssl-certificate-in-macos\/","title":{"rendered":"SSL Certificate on macOS"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">In most cases, Local makes getting your offline development environment running HTTPS easy by providing a one-click solution for trusting a site&#8217;s SSL certificate.<br><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Occasionally, if that &#8220;trust&#8221; process doesn&#8217;t work, you&#8217;ll need to manually let your Mac know that it can trust the Local site&#8217;s certificate. Newer macOS versions do not allow Local to trust an SSL certificate automatically. If you are experiencing this issue, follow the steps below. <\/p>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<div class=\"wp-block-group help-doc-toc\"><div class=\"wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained\">\n<p class=\"wp-block-paragraph\">Table of Contents:<\/p>\n\n\n<nav aria-label=\"Table of Contents\" class=\"wp-block-table-of-contents\"><ol><li><a class=\"wp-block-table-of-contents__entry\" href=\"#create-certificate-with-local\">Step 1: Create the certificate with Local<\/a><\/li><li><a class=\"wp-block-table-of-contents__entry\" href=\"#macos-keychain-access\">Step 2: Keychain Access<\/a><\/li><li><a class=\"wp-block-table-of-contents__entry\" href=\"#verify-certificate-is-trusted\">Step 3: Verify the certificate is trusted<\/a><\/li><li><a class=\"wp-block-table-of-contents__entry\" href=\"#update-urls-within-database\">Step 4: Update the URLs within the Database<\/a><\/li><li><a class=\"wp-block-table-of-contents__entry\" href=\"#ssl-err-cert-invalid-local-v6.4.1\">SSL  ERR_CERT_INVALID on Local v6.4.1+<\/a><\/li><\/ol><\/nav><\/div><\/div>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading has-text-color\" id=\"create-certificate-with-local\" style=\"color:#000000\"><strong>Step 1: Create the certificate with Local<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The first, click the &#8220;Trust&#8221; button next to the &#8220;SSL&#8221; section of the &#8220;Site Overview&#8221; page.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Clicking the button directs Local to generate a certificate with the correct information about this site and attempt to register the certificate with macOS.<\/p>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<figure class=\"wp-block-video\"><video height=\"664\" style=\"aspect-ratio: 1012 \/ 664;\" width=\"1012\" controls src=\"https:\/\/localwp.com\/wp-content\/uploads\/2021\/04\/local-ssl-trusting-certificate.mp4\"><\/video><figcaption class=\"wp-element-caption\"> <\/figcaption><\/figure>\n\n\n\n<div style=\"height:40px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading has-text-color\" id=\"macos-keychain-access\" style=\"color:#000000\"><strong>Step 2: Keychain Access<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">In macOS, most secrets are stored in &#8220;Keychains.&#8221; Keychains include things like passwords, ssh keys, and, importantly for us, SSL certificates.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Using the &#8220;Keychain Access&#8221; application with macOS, we can search for the SSL certificate that Local created. Once found, you can manage all sorts of settings for that specific certificate.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In our case, we want to update the &#8220;<strong>When using this certificate<\/strong>&#8221; setting from &#8220;<strong>Use System Default<\/strong>&#8221; to &#8220;<strong>Always Trust<\/strong>.&#8221; &#8220;<strong>Always Trust<\/strong>&#8221; means that for this certificate and site, macOS will always trust the connection.<\/p>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1017\" height=\"605\" src=\"https:\/\/localwp.com\/wp-content\/uploads\/2021\/04\/local-ssl-in-macos-launching-keychain-access.png\" alt=\"A screenshot of finding and launching the Keychain Access application using Finder or Alfred.\" class=\"wp-image-642\" srcset=\"https:\/\/localwp.com\/wp-content\/uploads\/2021\/04\/local-ssl-in-macos-launching-keychain-access.png 1017w, https:\/\/localwp.com\/wp-content\/uploads\/2021\/04\/local-ssl-in-macos-launching-keychain-access-300x178.png 300w, https:\/\/localwp.com\/wp-content\/uploads\/2021\/04\/local-ssl-in-macos-launching-keychain-access-768x457.png 768w\" sizes=\"(max-width: 1017px) 100vw, 1017px\" \/><\/figure>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"889\" height=\"669\" src=\"https:\/\/localwp.com\/wp-content\/uploads\/2021\/04\/local-ssl-macos-keychain-access-always-trust.png\" alt=\"A screenshot of the Keychain Access application and manually updating the setting to have MacOS Always Trust the Local site's certificate.\" class=\"wp-image-643\" srcset=\"https:\/\/localwp.com\/wp-content\/uploads\/2021\/04\/local-ssl-macos-keychain-access-always-trust.png 889w, https:\/\/localwp.com\/wp-content\/uploads\/2021\/04\/local-ssl-macos-keychain-access-always-trust-300x226.png 300w, https:\/\/localwp.com\/wp-content\/uploads\/2021\/04\/local-ssl-macos-keychain-access-always-trust-768x578.png 768w\" sizes=\"(max-width: 889px) 100vw, 889px\" \/><\/figure>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<figure class=\"wp-block-video\"><video height=\"658\" style=\"aspect-ratio: 1008 \/ 658;\" width=\"1008\" controls src=\"https:\/\/localwp.com\/wp-content\/uploads\/2021\/04\/local-ssl-macos-manually-trust-certificate.mp4\"><\/video><\/figure>\n\n\n\n<div style=\"height:40px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading has-text-color\" id=\"verify-certificate-is-trusted\" style=\"color:#000000\"><strong>Step 3: Verify the certificate is trusted<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Now that the certificate is set to &#8220;<strong>Always Trust<\/strong>,&#8221; how can you verify everything is working?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Open the site in a browser again and ensure a &#8216;lock&#8217; in the address bar. If the &#8216;lock&#8217; is missing, the first thing to check is if the address bar has https:\/\/ at the beginning of the domain.<\/p>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<figure class=\"wp-block-video\"><video height=\"658\" style=\"aspect-ratio: 1008 \/ 658;\" width=\"1008\" controls src=\"https:\/\/localwp.com\/wp-content\/uploads\/2021\/04\/local-ssl-macos-verify-cert.mp4\"><\/video><\/figure>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading has-text-color\" id=\"update-urls-within-database\" style=\"color:#000000\"><strong>Step 4: Update the URLs within the Database<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Once you&#8217;ve got the Local site&#8217;s SSL certificate trusted with macOS, and have verified that the site can be successfully loaded over HTTPS, all that&#8217;s left to do is to update the URLs within the Local site&#8217;s database!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You can use a plugin like&nbsp;<a href=\"https:\/\/wordpress.org\/plugins\/better-search-replace\/\"><strong><span style=\"text-decoration: underline;\">Better Search Replace<\/span><\/strong><\/a>&nbsp;to search for the regular HTTP version of the URL and replace it with the HTTPS version of the URL.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Another option is to use&nbsp;<strong><span style=\"text-decoration: underline;\"><a href=\"https:\/\/wp-cli.org\/\">WP-CLI<\/a>&nbsp;<\/span><\/strong>which comes bundled with Local. To do this, all you have to do is:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Right-click on the site in Local and select &#8220;Open Site Shell&#8221;<\/li>\n\n\n\n<li>Within the terminal window that opens, use the <code>wp search-replace<\/code> command to update <code>http:\/\/<\/code> to <code>https:\/\/<\/code>. Using the above site as an example, the command would look something like:<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\"><code>wp search-replace 'http:\/\/ssl-madness.local' 'https:\/\/ssl-madness.local'<\/code><\/p>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<figure class=\"wp-block-video\"><video height=\"658\" style=\"aspect-ratio: 1008 \/ 658;\" width=\"1008\" controls src=\"https:\/\/localwp.com\/wp-content\/uploads\/2021\/04\/local-ssl-macos-verify-cert-and-update-site-db.mp4\"><\/video><\/figure>\n\n\n\n<div style=\"height:40px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading has-text-color\" id=\"ssl-err-cert-invalid-local-v6.4.1\" style=\"color:#000000\"><strong>SSL  ERR_CERT_INVALID on Local v6.4.1+<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Local v6.4.1 rolled out a fix for the untrusted SSL issues that users have experienced. The fix works well with newly created sites on v6.4.1, however, sites created on previous versions may still experience issues. This could result in an <code>ERR_CERT_INVALID<\/code> error when opening Chrome. If this happens to you, here are some steps for resolving that issue:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Navigate to your Library\/Application Support folder in your user directory.\n<ul class=\"wp-block-list\">\n<li>Open Finder window <\/li>\n\n\n\n<li>Click Go in the menu bar at the top of your screen.<\/li>\n\n\n\n<li>Select Go to Folder or use cmd+shift+g.<\/li>\n\n\n\n<li>Type ~\/Library and hit enter. <\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Local stores certificates here: ~\/Library\/Application\\ Support\/Local\/run\/router\/nginx\/certs<\/li>\n\n\n\n<li>If your site is experiencing the issue, you can delete the certificate from this folder and then regenerate (\u201cTrust\u201d) the certificate from the Local UI.<\/li>\n\n\n\n<li>If it is happening to more than one site or this is tedious, you can delete the entire certs folder and Local will handle recreating the folder again.<\/li>\n<\/ul>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img decoding=\"async\" width=\"1024\" height=\"598\" src=\"https:\/\/localwp.com\/wp-content\/uploads\/2022\/06\/lhd-ssl-error-library-application-window-1024x598.png\" alt=\"MacOS Library in your user directory. Library &gt; Application Support &gt; Local &gt; run &gt; router &gt; nginx &gt; certs\n\" class=\"wp-image-1696\" style=\"width:840px;height:490px\" srcset=\"https:\/\/localwp.com\/wp-content\/uploads\/2022\/06\/lhd-ssl-error-library-application-window-1024x598.png 1024w, https:\/\/localwp.com\/wp-content\/uploads\/2022\/06\/lhd-ssl-error-library-application-window-300x175.png 300w, https:\/\/localwp.com\/wp-content\/uploads\/2022\/06\/lhd-ssl-error-library-application-window-768x449.png 768w, https:\/\/localwp.com\/wp-content\/uploads\/2022\/06\/lhd-ssl-error-library-application-window.png 1380w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<div style=\"height:40px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<div class=\"wp-block-buttons is-content-justification-center is-layout-flex wp-container-core-buttons-is-layout-fe48e5de wp-block-buttons-is-layout-flex\">\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link wp-element-button\" href=\"https:\/\/community.localwp.com\/c\/support\/5\" target=\"_blank\" rel=\"noreferrer noopener\">Get Community Support<\/a><\/div>\n<\/div>\n\n\n\n<div style=\"height:100px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n","protected":false},"excerpt":{"rendered":"<p>In most cases, Local makes getting your offline development environment running HTTPS easy by providing a one-click solution for trusting a site&#8217;s SSL certificate. Occasionally, if that &#8220;trust&#8221; process doesn&#8217;t work, you&#8217;ll need to manually let your Mac know that it can trust the Local site&#8217;s certificate. Newer macOS versions do not allow Local to&#8230;<\/p>\n","protected":false},"author":49,"parent":346,"menu_order":15,"template":"","tags":[29],"helpcategories":[2],"class_list":["post-632","help","type-help","status-publish","hentry","tag-ssl","helpcategories-general"],"acf":{"help_keywords":""},"_links":{"self":[{"href":"https:\/\/localwp.com\/wp-json\/wp\/v2\/help-doc\/632","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/localwp.com\/wp-json\/wp\/v2\/help-doc"}],"about":[{"href":"https:\/\/localwp.com\/wp-json\/wp\/v2\/types\/help"}],"author":[{"embeddable":true,"href":"https:\/\/localwp.com\/wp-json\/wp\/v2\/users\/49"}],"version-history":[{"count":0,"href":"https:\/\/localwp.com\/wp-json\/wp\/v2\/help-doc\/632\/revisions"}],"up":[{"embeddable":true,"href":"https:\/\/localwp.com\/wp-json\/wp\/v2\/help-doc\/346"}],"wp:attachment":[{"href":"https:\/\/localwp.com\/wp-json\/wp\/v2\/media?parent=632"}],"wp:term":[{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/localwp.com\/wp-json\/wp\/v2\/tags?post=632"},{"taxonomy":"helpcategories","embeddable":true,"href":"https:\/\/localwp.com\/wp-json\/wp\/v2\/helpcategories?post=632"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}