Skip to content

Commit 64be23b

Browse files
committed
cargo: Add codesigning runner script for MacOS
On MacOS, communicating with the hypervisor requires that a binary be signed with an "entitlement" `com.apple.security.hypervisor`. This commit adds a script that locally signs and then runs a binary, and configures Cargo to use that script to run tests/exmaples/etc. Signed-off-by: Lucy Menon <168595099+syntactically@users.noreply.github.com>
1 parent 75d114a commit 64be23b

3 files changed

Lines changed: 16 additions & 0 deletions

File tree

.cargo/config.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[target.'cfg(target_os = "macos")']
2+
runner = "dev/macos-sign-and-run.sh"

dev/macos-entitlements.plist

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>com.apple.security.hypervisor</key>
6+
<true/>
7+
</dict>
8+
</plist>

dev/macos-sign-and-run.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env bash
2+
set -Eeuo pipefail
3+
4+
5+
codesign -f -s - --entitlements "$(dirname "$0")/macos-entitlements.plist" "$1"
6+
exec "$@"

0 commit comments

Comments
 (0)