@@ -220,7 +220,7 @@ MACOS_NEWEST_UNSUPPORTED="16.0"
220220MACOS_OLDEST_SUPPORTED=" 13.0"
221221
222222# For Homebrew on Linux
223- REQUIRED_RUBY_VERSION=2.6 # https://github.com/Homebrew/brew/pull/6556
223+ REQUIRED_RUBY_VERSION=3.4 # https://github.com/Homebrew/brew/pull/19779
224224REQUIRED_GLIBC_VERSION=2.13 # https://docs.brew.sh/Homebrew-on-Linux#requirements
225225REQUIRED_CURL_VERSION=7.41.0 # HOMEBREW_MINIMUM_CURL_VERSION in brew.sh in Homebrew/brew
226226REQUIRED_GIT_VERSION=2.7.0 # HOMEBREW_MINIMUM_GIT_VERSION in brew.sh in Homebrew/brew
@@ -421,8 +421,8 @@ test_ruby() {
421421 fi
422422
423423 " $1 " --enable-frozen-string-literal --disable=gems,did_you_mean,rubyopt -rrubygems -e \
424- " abort if Gem::Version.new(RUBY_VERSION.to_s.dup).to_s.split('.').first(2) != \
425- Gem::Version.new('${REQUIRED_RUBY_VERSION} ').to_s.split('.').first(2) " 2> /dev/null
424+ " abort if Gem::Version.new(RUBY_VERSION) < \
425+ Gem::Version.new('${REQUIRED_RUBY_VERSION} ')" 2> /dev/null
426426}
427427
428428test_curl () {
@@ -489,7 +489,7 @@ find_tool() {
489489}
490490
491491no_usable_ruby () {
492- [[ -z " $( find_tool ruby) " ]]
492+ [[ -z " $( find_tool ruby) " ]] || ! ruby -e " require 'erb' "
493493}
494494
495495outdated_glibc () {
@@ -498,17 +498,22 @@ outdated_glibc() {
498498 version_lt " ${glibc_version} " " ${REQUIRED_GLIBC_VERSION} "
499499}
500500
501- if [[ -n " ${HOMEBREW_ON_LINUX-} " ]] && no_usable_ruby && outdated_glibc
501+ if [[ -n " ${HOMEBREW_ON_LINUX-} " ]] && no_usable_ruby
502502then
503- abort " $(
504- cat << EOABORT
503+ if outdated_glibc
504+ then
505+ abort " $(
506+ cat << EOABORT
505507Homebrew requires Ruby ${REQUIRED_RUBY_VERSION} which was not found on your system.
506508Homebrew portable Ruby requires Glibc version ${REQUIRED_GLIBC_VERSION} or newer,
507509and your Glibc version is too old. See:
508510 ${tty_underline} https://docs.brew.sh/Homebrew-on-Linux#requirements${tty_reset}
509511Please install Ruby ${REQUIRED_RUBY_VERSION} and add its location to your PATH.
510512EOABORT
511- ) "
513+ ) "
514+ else
515+ export HOMEBREW_FORCE_VENDOR_RUBY=1
516+ fi
512517fi
513518
514519# Invalidate sudo timestamp before exiting (if it wasn't active before).
0 commit comments