title: RubyOnRails/OSX: no such file to load -- openssl
body: <p>i'm getting a "no such file to load -- openssl" error when trying to open a page!</p>
  
  <p>i've googled for hours now, and none of the solutions i found worked for me :(</p>
  
  <p>i'm on OSX (10.6.6) running ruby 1.9.2p136 (installed via rvm(multiuser installation))</p>
  
  <p>here is a list of my local gems:</p>
  
  <pre>
  *** LOCAL GEMS ***
  
  abstract (1.0.0)  
  actionmailer (3.0.4, 3.0.3)  
  actionpack (3.0.4, 3.0.3)  
  activemodel (3.0.4, 3.0.3)  
  activerecord (3.0.4, 3.0.3)  
  activeresource (3.0.4, 3.0.3)  
  activesupport (3.0.4, 3.0.3)  
  arel (2.0.8, 2.0.7, 2.0.4)  
  bcrypt-ruby (2.1.4)  
  builder (3.0.0, 2.1.2)  
  bundler (1.0.10)  
  devise (1.1.5, 1.1.4)  
  erubis (2.6.6)  
  haml (3.0.25)  
  i18n (0.5.0, 0.4.2)  
  mail (2.2.15, 2.2.10)  
  mime-types (1.16)  
  openssl-extensions (1.1.0)  
  polyglot (0.3.1)  
  rack (1.2.1)  
  rack-mount (0.6.13)  
  rack-test (0.5.7, 0.5.6)  
  rails (3.0.4, 3.0.3)  
  railties (3.0.4, 3.0.3)  
  rake (0.8.7)  
  sqlite3 (1.3.3)  
  sqlite3-ruby (1.3.3, 1.3.2)  
  thor (0.14.6)  
  treetop (1.4.9)  
  tzinfo (0.3.24, 0.3.23)  
  warden (1.0.3)  
  </pre>
  
  <p>please help...i'm new to ruby on rails and totally lost at this point here :(</p>
  
  <p>thx</p>
  
  <p>matthias</p>
  
  <p><strong>Update:</strong><br>
  I tried to recompile openssl by hand doing this (as root user):</p>
  
  <pre>
  cd /usr/local/rvm/src/ruby-1.9.2-p136/ext/openssl  
  ruby extconf.rb  
  make  
  sudo make install  
  </pre>
  
  <p>but ruby extconf.rb outputted an error:</p>
  
  <pre>
  === OpenSSL for Ruby configurator ===  
  === Checking for system dependent stuff... ===  
  checking for t_open() in -lnsl... no  
  checking for socket() in -lsocket... no  
  checking for assert.h... yes  
  === Checking for required stuff... ===  
  checking for openssl/ssl.h... no  
  === Checking for required stuff failed. ===  
  
  Makefile wasn't created. Fix the errors above.
  </pre>
  
  <p>what can i do about it?</p>
  
  <p><strong>Update 2:</strong><br>
  installed openssl via homebrew now:</p>
  
  <pre>
  brew install openssl  
  sudo brew link openssl  
  </pre>
  
  <p>everything worked, no errors!</p>
  
  <p>then did the following:</p>
  
  <pre>
  rvm remove 1.9.2
  rvm install 1.9.2 --with-openssl-dir=/usr/local/etc
  </pre>
  
  <p>last one outputted this:</p>
  
  <pre>
  /usr/local/rvm/rubies/ruby-1.9.2-p136, this may take a while depending on your cpu(s)...
  
  ruby-1.9.2-p136 - #fetching   
  ruby-1.9.2-p136 - #extracting ruby-1.9.2-p136 to /usr/local/rvm/src/ruby-1.9.2-p136  
  ruby-1.9.2-p136 - #extracted to /usr/local/rvm/src/ruby-1.9.2-p136  
  ruby-1.9.2-p136 - #configuring  
  ruby-1.9.2-p136 - #compiling  
  Error running 'make ', please read /usr/local/rvm/log/ruby-1.9.2-p136/make.log  
  There has been an error while running make. Halting the installation.  
  root@MatthiasMacBookPro~$ Error running 'make ', please read /usr/local/rvm/log/ruby-1.9.2-p136/make.log  
  Error: Only takes 0 or 1 arguments  
  </pre>
  
  <p>get the make.log here: <a href="http://matthias-ptx4s.posterous.com/private/kksnjfiJoB" rel="nofollow">http://matthias-ptx4s.posterous.com/private/kksnjfiJoB</a></p>
  
  <p><strong>Update 3:</strong></p>
  
  <p>when i switch via rvm to ruby 1.8.5 everthings just works. so why doesn't it when i switch to 1.9.2-head !?</p>
  
  <p><strong>Solution:</strong></p>
  
  <p>Openssl was somehow compiled for 32bit. i fixed it by deleting all openssl versions and reinstalling it with via mac ports:</p>
  
  <pre>
  sudo port install openssl +universal
  </pre>
  
  <p>mac ports install openssl at /opt/local by default so you need to add this path when installing ruby:</p>
  
  <pre>
  sudo rvm install 1.9.2 --with-openssl-dir=/opt/local
  </pre>
  
  <p>voila :)</p>