title: How to add a Root CA Cert for Ruby on Mac
body: <p>I am trying to find an answer to some simple questions.  </p>
  
  <ol>
  <li>What certificates does Ruby use when doing SSL? (I assume this goes for <code>gem</code> as well)</li>
  <li>How can I add a root certificate to the trusted set of CA certs. </li>
  <li>Are there best practices for this? Where is it documented?</li>
  </ol>
  
  <p><strong>Background</strong></p>
  
  <p>I am using a mac (Sierra currently), and rbenv/ruby-build for installing rubies.
  We have set up an internal rubygems repository using Sonatype Nexus.  The server's certificate is signed by the company's internal root certificate, which I have a copy of.</p>
  
  <p>As soon as I tried to add our repository as a source</p>
  
  <p><code>gem sources --add https://our.repository.com/bla/bla</code></p>
  
  <p>it barfed about the certificate's root not being trusted.  This is the same issue I encounter when trying to pull from the repository (as a proxy) and would be an issue for any other teams using our gems.  I need a good solution to advise my team and others.</p>
  
  <p>Obviously, I am able to use it if I set the environment variable <code>SSL_CERT_FILE=/path/to/root_cert.pem</code>.  But I would prefer to place the cert file in a trusted location and let it work transparently as I would for Java trust stores.</p>