Repository navigation
rbenv Ruby 3.0.6 "cannot load such file -- socket" #2625
|
I'm on a new Mac: M5 Pro, OS Tahoe 26.4. Installed rbenv fresh, and installed ruby 3.0.6 with it, using a patch as outlined in other threads. For the record, these are the commands I used: Ruby 3.0.6 is installed successfully. However, when trying I tried installing and using 3.1.0 on a separate directory and installing bundler and I'm getting the same error. I also ran the |
Replies: 3 comments 7 replies
|
Hi, since this is not a bug with rbenv, but a build failure in Ruby's own build system, I've converted this to a Discussion in the ruby-build repository. First of all, I can reproduce this on macOS 26.2 when attempting to install both Ruby 3.0.6 and the latest 3.0.x version, Ruby 3.0.7: $ curl -fsSL https://github.com/ruby/ruby/commit/1dfe75b0beb7171b8154ff0856d5149be0207724.patch | \
rbenv install 3.0 --force --keep --patch -- --with-ext=socket,+Some notes:
I get this output: We can see that "socket" extension failed to compile, and now the build is properly aborted. The reason why the extension failed to compile might be in the extension's own log, which I'm uploading here: https://gist.github.com/mislav/46a5082b48f42938e41632f4f165b9c9 This log file is hard to read because it contains everything that Ruby attempted to test during "socket" extension compilation, and that may include warnings and errors that were non-fatal. In fact, by casually scanning this log file I can't detect what exactly is the cause of the error, but I know for a fact that Ruby 3.0 was able to compile using an older version of macOS. This might be an example of an issue that stems from newer macOS changing some of its libraries and APIs, and older Rubies become incompatible with the OS due to their EoL (End-of-Life) status. You may be able to find another patch to apply to this Ruby version, but instead I'd strongly advise you to upgrade your project to a Ruby version that compiles on your system. Finally, do NOT do |
|
I found a workaround for Ruby 3.0.x / 3.1.x on macOS 26 (Tahoe) — missing Ruby 3.0 and 3.1 are EoL and their I created two gist patches that fix this:
Replace the version number ( After install, verify: ruby -e "require 'socket'; puts Socket::AF_INET6" #=> 30And as @mislav already noted above — do not run |
|
For me, the missing include file was a red herring for ruby 3.1.7. Using this env var worked without patches: The key is the Explanation (AI-generated):
|
I found a workaround for Ruby 3.0.x / 3.1.x on macOS 26 (Tahoe) — missing
/usr/include/netinet6/in6.hRuby 3.0 and 3.1 are EoL and their
ext/socket/extconf.rbhardcodesFile.read("/usr/include/netinet6/in6.h")at build time. macOS 26 no longer has/usr/include/— system headers are inside the SDK only.I created two gist patches that fix this:
Ruby 3.0.x (includes BigDecimal
maybe_unusedfix + socket SDK path fix):Ru…