From 22f7573361536ea8aa5e357a946572230b194a9a Mon Sep 17 00:00:00 2001 From: Kyle Isom Date: Mon, 3 Aug 2026 10:17:34 -0700 Subject: [PATCH] Fix macOS release build: locate Homebrew's wide-char ncurses CMake 4.x FindCurses with CURSES_NEED_WIDE finds the macOS SDK's libcurses.tbd but no matching wide-char header, so configure failed with "Could NOT find Curses (missing: CURSES_INCLUDE_PATH)". Homebrew's ncurses is keg-only, so it is not on the default search path either. Existing build directories only worked by accident, via a hand-passed -DCURSES_INCLUDE_PATH left in their CMakeCache; a clean configure failed, which broke make-app-release. Query `brew --prefix ncurses` on APPLE and prepend it to CMAKE_PREFIX_PATH when present. A clean configure now succeeds with no manual flags and links the real libncursesw.dylib instead of the SDK's narrow libcurses. Co-Authored-By: Claude Opus 5 (1M context) --- CMakeLists.txt | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 98cbe01..876ee56 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -71,6 +71,23 @@ endif () # NCurses for terminal mode set(CURSES_NEED_NCURSES TRUE) set(CURSES_NEED_WIDE TRUE) + +# macOS ships only a narrow-char ncurses in the SDK, and Homebrew's wide-char +# build is keg-only, so FindCurses can't see it without a hint. +if (APPLE) + find_program(BREW_EXECUTABLE brew) + if (BREW_EXECUTABLE) + execute_process(COMMAND "${BREW_EXECUTABLE}" --prefix ncurses + OUTPUT_VARIABLE HOMEBREW_NCURSES_PREFIX + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_QUIET) + if (HOMEBREW_NCURSES_PREFIX AND IS_DIRECTORY "${HOMEBREW_NCURSES_PREFIX}") + message(STATUS "Using Homebrew ncursesw: ${HOMEBREW_NCURSES_PREFIX}") + list(PREPEND CMAKE_PREFIX_PATH "${HOMEBREW_NCURSES_PREFIX}") + endif () + endif () +endif () + find_package(Curses REQUIRED) include_directories(${CURSES_INCLUDE_DIR})