- patchelf was passed '\$ORIGIN' (backslash-dollar inside single quotes), so the ELF rpath was a literal \$ORIGIN path — the loader never expanded it and the tools couldn't find libpq at runtime. Use '$ORIGIN'. - macOS awk program had \$1, which awk rejects as a syntax error; use $1 (verified locally: otool -> install_name_tool -> all 3 tools run).