puma: OpenSSL 3 - symbol not found in flat namespace '_SSL_get1_peer_certificate'

Describe the bug A clear and concise description of what the bug is.

I’ve been attempting to spin up a new rails 6 or 7 project, but haven’t been able to do so due to a consistent issue with puma and open SSL

puma_http11.bundle, 0x0009): symbol not found in flat namespace '_SSL_get1_peer_certificate'

Puma config:

NA

To Reproduce

Mac 12.0.1 Intel, OpenSSL 3 installed via brew + Puma.

rails new project

Anyone able to give some tips here?

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 26
  • Comments: 43 (19 by maintainers)

Commits related to this issue

Most upvoted comments

I encountered this problem and the way I was able to resolve it is follows,

$ bundle config build.puma --with-pkg-config=$(brew --prefix openssl@1.1)/lib/pkgconfig
$ bundle install --redownload

M1 Max x Ruby 3.0.5 (installed via rbenv 1.2.0-64-gaf9201e) x puma 5.6.4.

I did not have to reinstall ruby to specify build options, or remove openssl@3 😃

not sure if this helps anyone else – but after creating a new rails 7 project, downgrading puma to 4.3 resolves this for me.

I suspect it should be

--with-openssl-dir=$(brew --prefix openssl)

I encountered this problem and the way I was able to resolve it is follows,

$ bundle config build.puma --with-pkg-config=$(brew --prefix openssl@1.1)/lib/pkgconfig
$ bundle install --redownload

M1 Max x Ruby 3.0.5 (installed via rbenv 1.2.0-64-gaf9201e) x puma 5.6.4.

I did not have to reinstall ruby to specify build options, or remove openssl@3 😃

thanks @dux your solution works fine with my mac pro m1 pro because no need to reinstall ruby

For anyone else having this issue if you have both openssl 3 and 1 - more common these days (2023) - most deployments of puma don’t need ssl support (would normally run behind a proxy) you can get around this issue with

PUMA_DISABLE_SSL=1 bundle

For anyone like me who use rvm, since ‘_SSL_get1_peer_certificate’ belongs to openssl@3 on Mac, remove your current ruby (for a clean install), then run rvm install RUBY_VERSION --with-openssl-dir=/usr/local/opt/openssl@3 to reinstall ruby with the correct OpenSSL version. (Also good to confirm the existence of /usr/local/opt/openssl@3 before you do this)

Experiencing the same issue symbol not found in flat namespace '_SSL_get1_peer_certificate' while moving existing Rails application set up to Apple M1Pro macOS 12.1 and OpenSSL 3 is installed via Homebrew. I’m using Ruby 3.0.1

Resolved my issue after removing the OpenSSL 3 and gem install puma -v '5.5.2' -- --with-cppflags=-I$(brew --prefix openssl)/include using the default openssl installed on macOS i.e. LibreSSL 2.8.3

M1 macbook, ruby 2.6.8, OpenSSL 3 installed along with OpenSSL 1.1

Ran into symbol not found in flat namespace '_SSL_get1_peer_certificate' when trying to build a client application. The way I was able to overcome it was by uninstalling my current ruby version and installing it again using these commands.

CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl@1.1)" RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl@1.1)" rbenv install 2.6.8
gem install bundler -v 2.2.33 # install the bundler version in your Gemfile.lock
bundle config build.puma --with-cppflags=-I$(brew --prefix openssl@1.1)/include
bundle install

I had the same problem and below was my solution Rails 7.0.2.2 ruby 3.1.0p0 (2021-12-25 revision fb4df44d16) [arm64-darwin21] Mac Mini m1 - ProductName: macOS ProductVersion: 12.1 BuildVersion: 21C52

  1. brew reinstall openssl@3
  2. rvm reinstall 3.1.0 --with-openssl-dir=brew --prefix openssl

Hope this helps someone.

what kaysiz said helped me, but unfortunately he made a typo. here are correct commands

$ brew reinstall openssl@3
$ rvm reinstall 3.1.4 --with-openssl-dir=$(brew --prefix openssl)

I’m going to close this. Unless the following reports OpenSSL 3.0.x, you need to build Ruby with OpenSSL 3.0.x, then install/build Puma.

ruby -ropenssl -e "puts %Q[\ \ \ Build: #{OpenSSL::OPENSSL_VERSION}\n Runtime: #{OpenSSL::OPENSSL_LIBRARY_VERSION}]"

The first version of Ruby that has been tested with OpenSSL 3 is 3.1.0. You may be able to install the Ruby OpenSSL gem (gem install openssl) or later with Ruby 2.6 or later.

Hi @MSP-Greg

It is

 Build: OpenSSL 1.1.1l  24 Aug 2021
 Runtime: OpenSSL 1.1.1m  14 Dec 2021