From 552076f706c2b02aff1aa05ecf33781ae4ef81b8 Mon Sep 17 00:00:00 2001 From: Jonathan del Strother Date: Tue, 18 Jan 2022 10:23:01 +0000 Subject: [PATCH] Fix `rake install` on M1 macs With the stricter code-signing requirements on M1 macs, `cp`ing the binary exposes a bug in Apple code-signing where trying to execute the resulting binary immediately exits with "Killed: 9" By rm-ing then cp-ing, the destination file gets a new inode number and avoids this problem. https://developer.apple.com/documentation/security/updating_mac_software --- Rakefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Rakefile b/Rakefile index 73b4301..c3945fd 100644 --- a/Rakefile +++ b/Rakefile @@ -10,7 +10,11 @@ end desc "builds & installs the binary to $GOPATH/bin" task :install => :build do - cp "bin/scmpuff", "#{ENV['GOPATH']}/bin/scmpuff" + # Don't cp directly over an existing file - it causes problems with Apple code signing. + # https://developer.apple.com/documentation/security/updating_mac_software + destination = "#{ENV['GOPATH']}/bin/scmpuff" + rm destination if File.exist?(destination) + cp "bin/scmpuff", destination end desc "run unit tests"