diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3c5d37a13..de3cb838d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,7 @@
- api: add special value `-` (hyphen-minus) in options of function command_options to prevent execution of commands
- relay/api: allow array with multiple requests in websocket frame received from client
- core, plugins: simplify help on parameters that can be repeated in commands
+- build: fix detection of Ruby on macOS 14, require CMake ≥ 3.18 ([#1156](https://github.com/weechat/weechat/issues/1156))
- build: require Curl ≥ 7.47.0 ([#2195](https://github.com/weechat/weechat/issues/2195))
- build: require GnuTLS ≥ 3.3.0 ([#2193](https://github.com/weechat/weechat/issues/2193))
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9ea985413..5d15a3548 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -19,7 +19,7 @@
# along with WeeChat. If not, see .
#
-cmake_minimum_required(VERSION 3.12)
+cmake_minimum_required(VERSION 3.18)
project(weechat C)
diff --git a/cmake/FindRuby.cmake b/cmake/FindRuby.cmake
deleted file mode 100644
index 6f681778a..000000000
--- a/cmake/FindRuby.cmake
+++ /dev/null
@@ -1,45 +0,0 @@
-#
-# Copyright (C) 2003-2024 Sébastien Helleu
-#
-# This file is part of WeeChat, the extensible chat client.
-#
-# WeeChat is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# WeeChat is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with WeeChat. If not, see .
-#
-
-# - Find Ruby
-# This module finds if Ruby is installed and determines where the include files
-# and libraries are. It also determines what the name of the library is. This
-# code sets the following variables:
-#
-# RUBY_INCLUDE_DIRS = C flags to compile with ruby
-# RUBY_LIBRARY_DIRS = linker flags to compile with ruby (found with pkg-config)
-# RUBY_LIB = ruby library (found without pkg-config)
-
-if(RUBY_FOUND)
- # Already in cache, be silent
- set(RUBY_FIND_QUIETLY TRUE)
-endif()
-
-find_package(PkgConfig)
-if(PKG_CONFIG_FOUND)
- if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
- # set specific search path for macOS
- set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:/usr/local/opt/ruby/lib/pkgconfig")
- endif()
- pkg_search_module(RUBY ruby-3.3 ruby-3.2 ruby-3.1 ruby-3.0 ruby-2.7 ruby-2.6 ruby-2.5 ruby-2.4 ruby-2.3 ruby-2.2 ruby-2.1 ruby-2.0 ruby-1.9 ruby)
- if(RUBY_FOUND AND ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
- # FIXME: weird hack: hardcoding the Ruby lib location on macOS
- set(RUBY_LDFLAGS "${RUBY_LDFLAGS} -L/usr/local/opt/ruby/lib")
- endif()
-endif()
diff --git a/src/plugins/ruby/CMakeLists.txt b/src/plugins/ruby/CMakeLists.txt
index 2127684c4..9f921fde8 100644
--- a/src/plugins/ruby/CMakeLists.txt
+++ b/src/plugins/ruby/CMakeLists.txt
@@ -28,8 +28,8 @@ if(RUBY_FOUND)
# caused by Ruby headers (with Ruby ≥ 3.1.0)
# see: https://github.com/ruby/ruby/pull/7085
add_definitions(-Wno-unused-parameter)
- include_directories(${RUBY_INCLUDE_DIRS})
- target_link_libraries(ruby ${RUBY_LDFLAGS} weechat_plugins_scripts coverage_config)
+ include_directories(${Ruby_INCLUDE_DIRS})
+ target_link_libraries(ruby ${Ruby_LIBRARIES} weechat_plugins_scripts coverage_config)
endif(RUBY_FOUND)
install(TARGETS ruby LIBRARY DESTINATION "${WEECHAT_LIBDIR}/plugins")
diff --git a/tools/debian/patches/weechat_ubuntu_focal.patch b/tools/debian/patches/weechat_ubuntu_focal.patch
index 10cd0f6ff..60e914c11 100644
--- a/tools/debian/patches/weechat_ubuntu_focal.patch
+++ b/tools/debian/patches/weechat_ubuntu_focal.patch
@@ -1,5 +1,18 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 5d15a3548..0786637b9 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -19,7 +19,7 @@
+ # along with WeeChat. If not, see .
+ #
+
+-cmake_minimum_required(VERSION 3.18)
++cmake_minimum_required(VERSION 3.16)
+
+ project(weechat C)
+
diff --git a/debian-devel/rules b/debian-devel/rules
-index cab713c93..d2756333b 100755
+index 086056f76..559ccfffb 100755
--- a/debian-devel/rules
+++ b/debian-devel/rules
@@ -8,6 +8,7 @@ override_dh_auto_configure:
@@ -11,7 +24,7 @@ index cab713c93..d2756333b 100755
-DENABLE_MAN:BOOL=ON \
-DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo \
diff --git a/debian-stable/rules b/debian-stable/rules
-index cab713c93..d2756333b 100755
+index 086056f76..559ccfffb 100755
--- a/debian-stable/rules
+++ b/debian-stable/rules
@@ -8,6 +8,7 @@ override_dh_auto_configure:
@@ -22,3 +35,18 @@ index cab713c93..d2756333b 100755
-DENABLE_DOC:BOOL=ON \
-DENABLE_MAN:BOOL=ON \
-DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo \
+diff --git a/src/plugins/ruby/CMakeLists.txt b/src/plugins/ruby/CMakeLists.txt
+index 9f921fde8..2860f7d6d 100644
+--- a/src/plugins/ruby/CMakeLists.txt
++++ b/src/plugins/ruby/CMakeLists.txt
+@@ -28,8 +28,8 @@ if(RUBY_FOUND)
+ # caused by Ruby headers (with Ruby ≥ 3.1.0)
+ # see: https://github.com/ruby/ruby/pull/7085
+ add_definitions(-Wno-unused-parameter)
+- include_directories(${Ruby_INCLUDE_DIRS})
+- target_link_libraries(ruby ${Ruby_LIBRARIES} weechat_plugins_scripts coverage_config)
++ include_directories(${RUBY_INCLUDE_DIRS})
++ target_link_libraries(ruby ${RUBY_LIBRARY} weechat_plugins_scripts coverage_config)
+ endif(RUBY_FOUND)
+
+ install(TARGETS ruby LIBRARY DESTINATION "${WEECHAT_LIBDIR}/plugins")