Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

OpenSSL missing when installing Ruby 3.3.3 on MacOS Ventura #2416

Unanswered
mbajur asked this question in Build failures
Discussion options

This issue is haunting me since some 3.x version - i'm basically not able to install any newer ruby version on my Macbook (Ventura 13.6.1). I tried literally any single solution suggested on the internet and there were tons of them so it's not really possible to list them all in here so let's start with the basics. I tried doing that with rvm, asdf, mice, rbenv and the output is always the same.

The command:

$ asdf install ruby 3.3.3
ruby-build: using openssl@3 from homebrew
==> Downloading ruby-3.3.3.tar.gz...
-> curl -q -fL -o ruby-3.3.3.tar.gz https://cache.ruby-lang.org/pub/ruby/3.3/ruby-3.3.3.tar.gz
 % Total % Received % Xferd Average Speed Time Time Time Current
 Dload Upload Total Spent Left Speed
100 21.0M 100 21.0M 0 0 2364k 0 0:00:09 0:00:09 --:--:-- 2334k
==> Installing ruby-3.3.3...
ruby-build: using libyaml from homebrew
ruby-build: using gmp from homebrew
-> ./configure "--prefix=$HOME/.asdf/installs/ruby/3.3.3" --with-openssl-dir=/usr/local/opt/openssl@3 --enable-shared --with-libyaml-dir=/usr/local/opt/libyaml --with-gmp-dir=/usr/local/opt/gmp --with-ext=openssl,psych,+
-> make -j 8
*** Following extensions are not compiled:
openssl:
	Could not be configured. It will not be installed.
	/private/var/folders/d2/gs16y4gn62d5pt9z7wvgsmnw0000gn/T/ruby-build.20240621193929.59571.rzZqWS/ruby-3.3.3/ext/openssl/extconf.rb:122: OpenSSL library could not be found. You might want to use --with-openssl-dir=<dir> option to specify the prefix where OpenSSL is installed.
	Check /var/folders/d2/gs16y4gn62d5pt9z7wvgsmnw0000gn/T/ruby-build.20240621193929.59571.rzZqWS/ruby-3.3.3/ext/openssl/mkmf.log for more details.
psych:
	Could not be configured. It will not be installed.
	Check /var/folders/d2/gs16y4gn62d5pt9z7wvgsmnw0000gn/T/ruby-build.20240621193929.59571.rzZqWS/ruby-3.3.3/ext/psych/mkmf.log for more details.
BUILD FAILED (macOS 13.6.1 on arm64 using ruby-build 20240612)
You can inspect the build directory at /var/folders/d2/gs16y4gn62d5pt9z7wvgsmnw0000gn/T/ruby-build.20240621193929.59571.rzZqWS
See the full build log at /var/folders/d2/gs16y4gn62d5pt9z7wvgsmnw0000gn/T/ruby-build.20240621193929.59571.log

And the log file produced: https://gist.github.com/mbajur/f944fb309cf86b95c44eb713a71418d8


The thing is, no matter what i do, no matter if i change the openssl dir with RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl@3)" , with @1.1, if i reinstall openssl completely or force any specific version to be used - ruby-build is always producing the same output with the same error message about OpenSSL missing.

I sincerly spent weeks on google trying to nail that down but at this point I'm affraid i will die as a Ruby 3.2.3 developer as that's the last version i managed to install on my macbook :)

Thanks in advance for your support and ideas!

You must be logged in to vote

Replies: 4 comments 8 replies

Comment options

I run in to the same thing installing 3.3.3 with Frum. But, I can install and un 3.3.2 no problem.

You must be logged in to vote
0 replies
Comment options

Hi, I'm sorry you're having trouble with Ruby 3.3.3. I cannot reproduce on macOS Sonoma, but I also do not have access to a Ventura machine.

Thanks for sharing your main build log, but when compiling ruby extensions such as "openssl" or "psych" fails, the relevant debugging information isn't in the main log, but in the individual log files listed in the error output that you've shared. The contents of those logs can be confusing, but if you share them, we might be able to spot what's going wrong in your case.

One thing you could check is whether your Homebrew is running under the same architecture as your CPU (see brew config). When Apple M1 architecture first shipped, a lot of software was incompatible, including Homebrew and some of its formula. To get around that, people used Rosetta to run Homebrew in amd64 mode instead of in arm64 mode (using commands like arch -x86_64 brew). Then they installed a bunch of software that way and forgot about the fact that their Homebrew is running and installing software under emulated CPU architecture. In my experience, this is often why Ruby can't link to those libraries even if they appear installed on the system.

You must be logged in to vote
2 replies
Comment options

=== OpenSSL for Ruby configurator ===
have_func: checking for rb_io_descriptor()... -------------------- yes
DYLD_LIBRARY_PATH=.:../.. "clang -o conftest -I../../.ext/include/x86_64-darwin23 -I../.././include -I../.././ext/openssl -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -fdeclspec -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wextra-tokens -Wdeprecated-declarations -Wdivision-by-zero -Wdiv-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wold-style-definition -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wmisleading-indentation -Wundef -pipe conftest.c -L. -L../.. -L. -fstack-protector-strong -lruby.3.3-static -framework CoreFoundation -ldl -lobjc -lpthread -lpthread "
ld: warning: ignoring duplicate libraries: '-lpthread'
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: int main(int argc, char **argv)
4: {
5: return !!argv[argc];
6: }
/* end */
DYLD_LIBRARY_PATH=.:../.. "clang -o conftest -I../../.ext/include/x86_64-darwin23 -I../.././include -I../.././ext/openssl -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -fdeclspec -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wextra-tokens -Wdeprecated-declarations -Wdivision-by-zero -Wdiv-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wold-style-definition -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wmisleading-indentation -Wundef -pipe conftest.c -L. -L../.. -L. -fstack-protector-strong -lruby.3.3-static -framework CoreFoundation -ldl -lobjc -lpthread -lpthread "
conftest.c:14:57: error: use of undeclared identifier 'rb_io_descriptor'
 14 | int t(void) { void ((*volatile p)()); p = (void ((*)()))rb_io_descriptor; return !p; }
 | ^
1 error generated.
checked program was:
/* begin */
 1: #include "ruby.h"
 2: 
 3: /*top*/
 4: extern int t(void);
 5: int main(int argc, char **argv)
 6: {
 7: if (argc > 1000000) {
 8: int (* volatile tp)(void)=(int (*)(void))&t;
 9: printf("%d", (*tp)());
10: }
11: 
12: return !!argv[argc];
13: }
14: int t(void) { void ((*volatile p)()); p = (void ((*)()))rb_io_descriptor; return !p; }
/* end */
DYLD_LIBRARY_PATH=.:../.. "clang -o conftest -I../../.ext/include/x86_64-darwin23 -I../.././include -I../.././ext/openssl -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -fdeclspec -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wextra-tokens -Wdeprecated-declarations -Wdivision-by-zero -Wdiv-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wold-style-definition -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wmisleading-indentation -Wundef -pipe conftest.c -L. -L../.. -L. -fstack-protector-strong -lruby.3.3-static -framework CoreFoundation -ldl -lobjc -lpthread -lpthread "
ld: warning: ignoring duplicate libraries: '-lpthread'
checked program was:
/* begin */
 1: #include "ruby.h"
 2: 
 3: /*top*/
 4: extern int t(void);
 5: int main(int argc, char **argv)
 6: {
 7: if (argc > 1000000) {
 8: int (* volatile tp)(void)=(int (*)(void))&t;
 9: printf("%d", (*tp)());
10: }
11: 
12: return !!argv[argc];
13: }
14: extern void rb_io_descriptor();
15: int t(void) { rb_io_descriptor(); return 0; }
/* end */
--------------------
have_func: checking for rb_io_maybe_wait(0, Qnil, Qnil, Qnil) in ruby/io.h... -------------------- yes
DYLD_LIBRARY_PATH=.:../.. "clang -o conftest -I../../.ext/include/x86_64-darwin23 -I../.././include -I../.././ext/openssl -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -fdeclspec -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wextra-tokens -Wdeprecated-declarations -Wdivision-by-zero -Wdiv-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wold-style-definition -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wmisleading-indentation -Wundef -pipe conftest.c -L. -L../.. -L. -fstack-protector-strong -lruby.3.3-static -framework CoreFoundation -ldl -lobjc -lpthread -lpthread "
ld: warning: ignoring duplicate libraries: '-lpthread'
checked program was:
/* begin */
 1: #include "ruby.h"
 2: 
 3: #include <ruby/io.h>
 4: 
 5: /*top*/
 6: extern int t(void);
 7: int main(int argc, char **argv)
 8: {
 9: if (argc > 1000000) {
10: int (* volatile tp)(void)=(int (*)(void))&t;
11: printf("%d", (*tp)());
12: }
13: 
14: return !!argv[argc];
15: }
16: 
17: int t(void) { rb_io_maybe_wait(0, Qnil, Qnil, Qnil); return 0; }
/* end */
--------------------
=== Checking for system dependent stuff... ===
have_library: checking for t_open() in -lnsl... -------------------- no
DYLD_LIBRARY_PATH=.:../.. "clang -o conftest -I../../.ext/include/x86_64-darwin23 -I../.././include -I../.././ext/openssl -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -fdeclspec -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wextra-tokens -Wdeprecated-declarations -Wdivision-by-zero -Wdiv-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wold-style-definition -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wmisleading-indentation -Wundef -pipe conftest.c -L. -L../.. -L. -fstack-protector-strong -lruby.3.3-static -framework CoreFoundation -ldl -lobjc -lpthread -lnsl -lpthread "
conftest.c:14:57: error: use of undeclared identifier 't_open'
 14 | int t(void) { void ((*volatile p)()); p = (void ((*)()))t_open; return !p; }
 | ^
1 error generated.
checked program was:
/* begin */
 1: #include "ruby.h"
 2: 
 3: /*top*/
 4: extern int t(void);
 5: int main(int argc, char **argv)
 6: {
 7: if (argc > 1000000) {
 8: int (* volatile tp)(void)=(int (*)(void))&t;
 9: printf("%d", (*tp)());
10: }
11: 
12: return !!argv[argc];
13: }
14: int t(void) { void ((*volatile p)()); p = (void ((*)()))t_open; return !p; }
/* end */
DYLD_LIBRARY_PATH=.:../.. "clang -o conftest -I../../.ext/include/x86_64-darwin23 -I../.././include -I../.././ext/openssl -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -fdeclspec -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wextra-tokens -Wdeprecated-declarations -Wdivision-by-zero -Wdiv-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wold-style-definition -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wmisleading-indentation -Wundef -pipe conftest.c -L. -L../.. -L. -fstack-protector-strong -lruby.3.3-static -framework CoreFoundation -ldl -lobjc -lpthread -lnsl -lpthread "
ld: warning: ignoring duplicate libraries: '-lpthread'
ld: library 'nsl' not found
clang: error: linker command failed with exit code 1 (use -v to see invocation)
checked program was:
/* begin */
 1: #include "ruby.h"
 2: 
 3: /*top*/
 4: extern int t(void);
 5: int main(int argc, char **argv)
 6: {
 7: if (argc > 1000000) {
 8: int (* volatile tp)(void)=(int (*)(void))&t;
 9: printf("%d", (*tp)());
10: }
11: 
12: return !!argv[argc];
13: }
14: extern void t_open();
15: int t(void) { t_open(); return 0; }
/* end */
--------------------
have_library: checking for socket() in -lsocket... -------------------- no
DYLD_LIBRARY_PATH=.:../.. "clang -o conftest -I../../.ext/include/x86_64-darwin23 -I../.././include -I../.././ext/openssl -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -fdeclspec -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wextra-tokens -Wdeprecated-declarations -Wdivision-by-zero -Wdiv-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wold-style-definition -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wmisleading-indentation -Wundef -pipe conftest.c -L. -L../.. -L. -fstack-protector-strong -lruby.3.3-static -framework CoreFoundation -ldl -lobjc -lpthread -lsocket -lpthread "
conftest.c:14:57: error: use of undeclared identifier 'socket'
 14 | int t(void) { void ((*volatile p)()); p = (void ((*)()))socket; return !p; }
 | ^
1 error generated.
checked program was:
/* begin */
 1: #include "ruby.h"
 2: 
 3: /*top*/
 4: extern int t(void);
 5: int main(int argc, char **argv)
 6: {
 7: if (argc > 1000000) {
 8: int (* volatile tp)(void)=(int (*)(void))&t;
 9: printf("%d", (*tp)());
10: }
11: 
12: return !!argv[argc];
13: }
14: int t(void) { void ((*volatile p)()); p = (void ((*)()))socket; return !p; }
/* end */
DYLD_LIBRARY_PATH=.:../.. "clang -o conftest -I../../.ext/include/x86_64-darwin23 -I../.././include -I../.././ext/openssl -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -fdeclspec -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wextra-tokens -Wdeprecated-declarations -Wdivision-by-zero -Wdiv-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wold-style-definition -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wmisleading-indentation -Wundef -pipe conftest.c -L. -L../.. -L. -fstack-protector-strong -lruby.3.3-static -framework CoreFoundation -ldl -lobjc -lpthread -lsocket -lpthread "
ld: warning: ignoring duplicate libraries: '-lpthread'
ld: library 'socket' not found
clang: error: linker command failed with exit code 1 (use -v to see invocation)
checked program was:
/* begin */
 1: #include "ruby.h"
 2: 
 3: /*top*/
 4: extern int t(void);
 5: int main(int argc, char **argv)
 6: {
 7: if (argc > 1000000) {
 8: int (* volatile tp)(void)=(int (*)(void))&t;
 9: printf("%d", (*tp)());
10: }
11: 
12: return !!argv[argc];
13: }
14: extern void socket();
15: int t(void) { socket(); return 0; }
/* end */
--------------------
=== Checking for required stuff... ===
pkg_config: checking for pkg-config for openssl... -------------------- not found
package configuration for openssl is not found
--------------------
have_header: checking for openssl/ssl.h... -------------------- no
DYLD_LIBRARY_PATH=.:../.. "clang -I../../.ext/include/x86_64-darwin23 -I../.././include -I../.././ext/openssl -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -fdeclspec -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wextra-tokens -Wdeprecated-declarations -Wdivision-by-zero -Wdiv-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wold-style-definition -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wmisleading-indentation -Wundef -pipe -c conftest.c"
conftest.c:3:10: fatal error: 'openssl/ssl.h' file not found
 3 | #include <openssl/ssl.h>
 | ^~~~~~~~~~~~~~~
1 error generated.
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: #include <openssl/ssl.h>
/* end */
--------------------
=== Checking for required stuff failed. ===
Makefile wasn't created. Fix the errors above.
/Library/ruby-3.3.6/ext/openssl/extconf.rb:122: OpenSSL library could not be found. You might want to use --with-openssl-dir=<dir> option to specify the prefix where OpenSSL is installed.
	/Library/ruby-3.3.6/ext/openssl/extconf.rb:122:in `<top (required)>'
	./ext/extmk.rb:227:in `load'
	./ext/extmk.rb:227:in `block in extmake'
	/Library/ruby-3.3.6/lib/mkmf.rb:314:in `open'
	./ext/extmk.rb:223:in `extmake'
	./ext/extmk.rb:648:in `block in <main>'
	./ext/extmk.rb:644:in `each'
	./ext/extmk.rb:644:in `<main>'
this is my ext/openssl/mkmf.log file, I use ruby-3.3.6 source code then do this
$ ./configure
$ make
$ sudo make install

but when " sudo make install" it has error.

Comment options

@nishuiaee Hi, you can work around most OpenSSL compilation or linking problems by simply using Homebrew to install openssl@3 and then just using ruby-build (or rbenv install) without any extra configuration. It will automatically link to Homebrew's openssl. Check the wiki for more info.

Comment options

Same error with Mac Os 15.0 and ruby version 3.3.5

You must be logged in to vote
4 replies
Comment options

I'm facing the very same issue with asdf and ruby 3.3.5.

Comment options

Hi all, if compiling "openssl" or "psych" (or both) extensions fails when compiling Ruby, then please:

  1. Check additional log files ext/openssl/mkmf.log and ext/psych/mkmf.log where actual failures of building these extensions can be found;
  2. Check brew config to verify the "Rosetta 2: false" line;
  3. brew reinstall openssl@3 libyaml

In summary, some additional info would be appreciated, otherwise it's really hard to tell what exactly went wrong. Thanks!

Comment options

Can you explain rosetta2: false?

Comment options

@alexgorski Certainly. If you run arch -x86_64 brew config, you will see that the outputs prints "Rosetta 2: true". What this means is that Homebrew detected that we're using Rosetta 2 (a software that is part of macOS) to run Homebrew as if it were run on Intel "x64" architecture. Apple shipped Rosetta 2 to ease the transition from Intel to Apple silicon Macs, and a lot of developers adopted it as a way to port their Homebrew installs and formulae from old Intel machines.

However, lots of developers forgot that they're using the arch -x86_64 trick, or have used the macOS migration assistant to port their Homebrew installs from an old machine, resulting in x64 binaries and libraries being imported to an M1/M2 machine, which will cause trouble down the line when compiling software (like Ruby) on "arm64" architecture. These errors are typically difficult to debug.

For instance, to check is one's brew invocation on the command line might be an alias to the arch trick, type this in a shell:

$ type brew
brew is /opt/homebrew/bin/brew # => expected output

In this case, what made me believe that something like x64 architecture emulation is going on is that the OP has their Homebrew install in /usr/local (the old location) as opposed to it being /opt/homebrew as is default on M1/M2 Macs.

Comment options

I was getting the same error not being "able to find openssl" despite the path being correct. But for me it was because I was trying to install on a M4 Mac that had been Migration Assistant'ed from an Intel MBP. I migrated my homebrew from /usr/local/Cellar to /opt/homebrew/Cellar using the top answer on this page and it installed with no problems.

You must be logged in to vote
2 replies
Comment options

Thanks! I got exactly the same issue. this worked like a charm for me !

Comment options

Thanks for sharing this solution, @silent-e! Worked like a charm for me as well! 🌮 🌮 🌮

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

AltStyle によって変換されたページ (->オリジナル) /