title: Ruby not finding new version of OpenSSL
body: <p>Where and when does <code>OpenSSL::OPENSSL_VERSION_NUMBER</code> get set?  And why isn't it getting set to the latest OpenSSL that I've just installed?</p>
  
  <p>First the error(s):</p>
  
  <pre><code>$ gem install activesupport -v '3.2.13'
  Error while executing gem ... (RuntimeError)
  Unsupported digest algorithm (SHA512)
  </code></pre>
  
  <p>If I go directly into irb, I can see that Ruby is using the "old" openssl:</p>
  
  <pre><code>$ irb
  &gt;&gt; require 'openssl'
  =&gt; true
  &gt;&gt; OpenSSL::Digest.new('sha512')
  RuntimeError: Unsupported digest algorithm (sha512)
  &gt;&gt; OpenSSL::OPENSSL_VERSION_NUMBER.to_s(16)
  "9070cf"
  </code></pre>
  
  <p>This tells me that Ruby isn't finding the local version of OpenSSL that I just built, which should be at least 0x908000.  The relevant code:</p>
  
  <pre><code># file: usr/lib/ruby/2.0.0/openssl/digest.rb
  ...
  alg = %w(DSS DSS1 MD2 MD4 MD5 MDC2 RIPEMD160 SHA SHA1)
  if OPENSSL_VERSION_NUMBER &gt; 0x00908000
    alg += %w(SHA224 SHA256 SHA384 SHA512)
  end
  </code></pre>
  
  <p>explains why it's not finding SHA512.</p>
  
  <p>But I don't know why Ruby is using the old version of OpenSSL.  I built OpenSSL and Ruby from fresh sources using</p>
  
  <pre><code>SANDBOX=/Users/me/sandboxes/ruby2
  PATH=$(SANDBOX)/usr/bin:$(PATH)
  
  # Create a fresh OpenSSL from sources
  (downloaded and unpacked http://www.openssl.org/source/openssl-1.0.1e.tar.gz)
  $ ./config --prefix=$(SANDBOX)/usr --openssldir=$(SANDBOX)/usr/openssl
  $ make ; make install ; make clean
  # verify openssl
  $ which openssl
  /Users/me/sandboxes/ruby2/usr/bin/openssl
  $ openssl version
  OpenSSL 1.0.1e 11 Feb 2013
  
  # Create a fresh Ruby from sources
  (download and unpack http://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p0.tar.gz)
  $ ./configure --prefix=$(SANDBOX)/usr --with-open-ssl-dir=$(SANDBOX)/usr/openssl
  $ make ; make intalll ; make clean
  # verify ruby
  $ which ruby
  /Users/me/sandboxes/ruby2/usr/bin/ruby
  </code></pre>
  
  <p>But this ruby doesn't appear to find the openssl 1.0.1e that I just built.  </p>
  
  <p>My understanding was that the <code>--with-open-ssl-dir</code> argument to <code>./configure</code> was necessary and sufficient to tell ruby to use the new OpenSSL, but that didn't seem to work.</p>
  
  <p>Any ideas on how to get Ruby to recognize the new OpenSSL that I've built?</p>
  
  <p>I've tried running <code>ruby extconf.rb ; make ; make install</code> as suggested by @Gaurish (below), but that still finds the OpenSSL installed in the system, not in my project root directory.</p>