title: Openssl "verify error:num=20:unable to get local issuer certificate" on Mac
body: <p>I am not able to get rid of error "unable to get local issuer certificate" even after going through almost all suggestions on Stack Overflow on my MacBook.</p>
  
  <pre><code>openssl s_client -connect www.google.com:443 -tls1 -showcerts -CApath /System/Library/OpenSSL
  CONNECTED(00000003)
  depth=2 /C=US/O=GeoTrust Inc./CN=GeoTrust Global CA
  verify error:num=20:unable to get local issuer certificate
  verify return:0
  ---
  Certificate chain
  &lt; Root and Intermediate Certificates &gt;
  </code></pre>
  
  <p>I get same error with below command where I have copied the GeoTrust Root CA cert.</p>
  
  <pre><code>openssl s_client -connect www.google.com:443 -tls1 -CApath /usr/local/etc/openssl
  </code></pre>
  
  <p>This is failing at Depth 2. I tried below variation:</p>
  
  <pre><code>openssl s_client -connect www.google.com:443 -tls1 -showcerts -CAfile ~/Certificates.pem
  </code></pre>
  
  <p>Here Certificates.pem contains all exported Root CA certificates from OSX's Keychain.</p>
  
  <p>It is failing to validate *.google.com which is at Depth 2.
  <a href="https://i.stack.imgur.com/9CxFW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9CxFW.png" alt="enter image description here"></a></p>
  
  <p>Any ideas how to get rid of that error? Any corner case due to use of WildCard certificates?</p>