@@ -13,8 +13,10 @@ import (
13
13
"text/template"
14
14
"time"
15
15
16
+ "github.com/coreos/go-semver/semver"
16
17
"github.com/lima-vm/lima/pkg/driver"
17
18
"github.com/lima-vm/lima/pkg/driverutil"
19
+ "github.com/lima-vm/lima/pkg/osutil"
18
20
"github.com/lima-vm/lima/pkg/qemu"
19
21
"github.com/lima-vm/lima/pkg/qemu/entitlementutil"
20
22
@@ -125,12 +127,19 @@ func Start(ctx context.Context, inst *store.Instance) error {
125
127
// Ask the user to sign the qemu binary with the "com.apple.security.hypervisor" if needed.
126
128
// Workaround for https://github.com/lima-vm/lima/issues/1742
127
129
if runtime .GOOS == "darwin" && inst .VMType == limayaml .QEMU {
128
- qExe , _ , err := qemu . Exe ( inst . Arch )
130
+ macOSProductVersion , err := osutil . ProductVersion ( )
129
131
if err != nil {
130
- return fmt . Errorf ( "failed to find the QEMU binary for the architecture %q: %w" , inst . Arch , err )
132
+ return err
131
133
}
132
- if accel := qemu .Accel (inst .Arch ); accel == "hvf" {
133
- entitlementutil .AskToSignIfNotSignedProperly (qExe )
134
+ // The codesign --xml option is only available on macOS Monterey and later
135
+ if ! macOSProductVersion .LessThan (* semver .New ("12.0.0" )) {
136
+ qExe , _ , err := qemu .Exe (inst .Arch )
137
+ if err != nil {
138
+ return fmt .Errorf ("failed to find the QEMU binary for the architecture %q: %w" , inst .Arch , err )
139
+ }
140
+ if accel := qemu .Accel (inst .Arch ); accel == "hvf" {
141
+ entitlementutil .AskToSignIfNotSignedProperly (qExe )
142
+ }
134
143
}
135
144
}
136
145
0 commit comments