{"id":4291,"date":"2020-11-16T17:19:43","date_gmt":"2020-11-16T23:19:43","guid":{"rendered":"https:\/\/dev.iachieved.it\/iachievedit\/?p=4291"},"modified":"2020-11-17T15:30:06","modified_gmt":"2020-11-17T21:30:06","slug":"macos-bundle-install-and-openssl","status":"publish","type":"post","link":"https:\/\/dev.iachieved.it\/iachievedit\/macos-bundle-install-and-openssl\/","title":{"rendered":"macOS Bundle Install and OpenSSL Gem"},"content":{"rendered":"<p>From time to time you run into an issue that requires no end of Googling to sort through.  That was my case with using <a href=\"https:\/\/bundler.io\/\">bundler<\/a> and the <a href=\"https:\/\/github.com\/ruby\/openssl\">OpenSSL gem<\/a> on <a href=\"https:\/\/www.apple.com\/macos\/big-sur\/\">macOS Big Sur<\/a>.  Your <code>Gemfile<\/code> has the following contents:<\/p>\n<p>[code lang=text]<br \/>\ngem &quot;openssl&quot;<br \/>\n[\/code]<\/p>\n<p>and when running <code>bundle install<\/code> you&#8217;re greeted with this nonsense:<\/p>\n<p>[code lang=text]<br \/>\nextconf.rb:99:in `&lt;main&gt;&#039;: OpenSSL library could not be found. You might want to use &#8211;with-openssl-dir=&lt;dir&gt; option to<br \/>\nspecify the prefix where OpenSSL is installed. (RuntimeError)<br \/>\n&#8230;<br \/>\nAn error occurred while installing openssl (2.2.0), and Bundler cannot continue.<br \/>\n[\/code]<\/p>\n<p>Using <code>gem install<\/code> &#8220;only&#8221; required the following incantation:<\/p>\n<p>[code lang=text]<br \/>\ngem install openssl &#8211;install-dir vendor\/bundle &#8212; &#8211;with-openssl-dir=\/usr\/local\/Cellar\/openssl@1.1\/1.1.1h<br \/>\n[\/code]<\/p>\n<p>For the life of me, though, I couldn&#8217;t figure out how to apply the <code>--with-openssl-dir<\/code> to <code>bundle<\/code>!<\/p>\n<p>Well, dear reader, here is how:<\/p>\n<p>[code lang=text]<br \/>\nbundle config path vendor\/bundle<br \/>\nbundle config build.openssl &#8211;with-openssl-dir=\/usr\/local\/Cellar\/openssl@1.1\/1.1.1h<br \/>\n[\/code]<\/p>\n<p>The first line is obligatory and is the &#8220;modern&#8221; way of setting <code>bundle<\/code>&#8216;s install path to <code>vendor\/bundle<\/code> (which odds are you want anyway).  The <code>build.openssl<\/code> setting will use the remaining information to pass to <code>gem<\/code> when installing <code>openssl<\/code>.<\/p>\n<p>It goes without saying that the exact path used is dependent on your environment; for my Mac the OpenSSL headers and libraries were hanging out in the <a href=\"https:\/\/brew.sh\/\">brew cellar<\/a>.<\/p>\n<p>Hopefully this post saves someone an hour or so!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>From time to time you run into an issue that requires no end of Googling to sort through. That was my case with using bundler and the OpenSSL gem on macOS Big Sur. Your Gemfile has the following contents: [code lang=text] gem &quot;openssl&quot; [\/code] and when running bundle install you&#8217;re greeted with this nonsense: [code [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11,111],"tags":[],"class_list":["post-4291","post","type-post","status-publish","format-standard","hentry","category-apple","category-ruby"],"_links":{"self":[{"href":"https:\/\/dev.iachieved.it\/iachievedit\/wp-json\/wp\/v2\/posts\/4291"}],"collection":[{"href":"https:\/\/dev.iachieved.it\/iachievedit\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dev.iachieved.it\/iachievedit\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dev.iachieved.it\/iachievedit\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dev.iachieved.it\/iachievedit\/wp-json\/wp\/v2\/comments?post=4291"}],"version-history":[{"count":6,"href":"https:\/\/dev.iachieved.it\/iachievedit\/wp-json\/wp\/v2\/posts\/4291\/revisions"}],"predecessor-version":[{"id":4298,"href":"https:\/\/dev.iachieved.it\/iachievedit\/wp-json\/wp\/v2\/posts\/4291\/revisions\/4298"}],"wp:attachment":[{"href":"https:\/\/dev.iachieved.it\/iachievedit\/wp-json\/wp\/v2\/media?parent=4291"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dev.iachieved.it\/iachievedit\/wp-json\/wp\/v2\/categories?post=4291"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dev.iachieved.it\/iachievedit\/wp-json\/wp\/v2\/tags?post=4291"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}