Skip to content

Commit

Permalink
Fix rake install on M1 macs
Browse files Browse the repository at this point in the history
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
  • Loading branch information
jdelStrother committed Jan 18, 2022
1 parent d519cd9 commit 552076f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 552076f

Please sign in to comment.