From 3650d38a8bf1722a117d5f0415c18a177af3159f Mon Sep 17 00:00:00 2001 From: zhangyue Date: Tue, 3 Mar 2026 14:37:49 +0800 Subject: [PATCH] Fix sed -i compatibility on macOS in configure macOS BSD sed requires an explicit empty string argument after -i (sed -i '' 'script' file), unlike GNU sed which takes -i without a suffix argument. Without this fix, BSD sed misinterprets the sed script as a backup suffix and treats the filename as the script, causing "unterminated substitute pattern" error. --- configure | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/configure b/configure index b9371321677..c9ce3d46302 100755 --- a/configure +++ b/configure @@ -24833,4 +24833,11 @@ fi # The configure args contain '-Wl,-rpath,\$$ORIGIN`, when it falls # as a C literal string, it's invalid, so converting `\` to `\\` # to be correct for C program. -sed -i '/define CONFIGURE_ARGS/s,\([^\\]\)\\\$\$,\1\\\\$$,g' src/include/pg_config.h +case $build_os in +darwin*) + sed -i '' '/define CONFIGURE_ARGS/s,\([^\\]\)\\\$\$,\1\\\\$$,g' src/include/pg_config.h + ;; +*) + sed -i '/define CONFIGURE_ARGS/s,\([^\\]\)\\\$\$,\1\\\\$$,g' src/include/pg_config.h + ;; +esac