From 71ad6955a2aa34eca9a16f1c2f6991cae03fa01a Mon Sep 17 00:00:00 2001 From: Keiko Oda Date: Wed, 29 Jan 2025 16:51:54 +0900 Subject: [PATCH] Sign built Go binaries for macOS Due to security enhancements in newer macOS versions, unsigned Go binaries may hang when built and executed locally. To prevent this, add code signing to `make build`. --- Makefile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Makefile b/Makefile index bc7397fe9..533d9bc3e 100644 --- a/Makefile +++ b/Makefile @@ -17,6 +17,12 @@ build_dist: go build -o ${OUTFILE} make -C helper OUTFILE=../pganalyze-collector-helper make -C setup OUTFILE=../pganalyze-collector-setup + # Sign built Go binaries for macOS + @if [ "$(shell uname)" = "Darwin" ] && command -v codesign > /dev/null 2>&1; then \ + codesign --force --sign - ${OUTFILE}; \ + codesign --force --sign - pganalyze-collector-helper; \ + codesign --force --sign - pganalyze-collector-setup; \ + fi build_dist_alpine: # Increase stack size from Alpine's default of 80kb to 2mb - otherwise we see