Skip to content

Commit a66b375

Browse files
committed
cli: fix broken flag for non-m3 devices on macOS 15
Signed-off-by: Abiola Ibrahim <[email protected]>
1 parent c1818be commit a66b375

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

cmd/start.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ func init() {
171171
}
172172

173173
// nested virtualization
174-
if util.M3() && util.MacOS15OrNewer() {
174+
if util.MacOSNestedVirtualizationSupported() {
175175
startCmd.Flags().BoolVarP(&startCmdArgs.NestedVirtualization, "nested-virtualization", "z", false, "enable nested virtualization")
176176
startCmd.Flag("nested-virtualization").Hidden = true
177177
}
@@ -457,7 +457,7 @@ func prepareConfig(cmd *cobra.Command) {
457457
startCmdArgs.VZRosetta = current.VZRosetta
458458
}
459459
}
460-
if util.MacOS15OrNewer() {
460+
if util.MacOSNestedVirtualizationSupported() {
461461
if !cmd.Flag("nested-virtualization").Changed {
462462
startCmdArgs.NestedVirtualization = current.NestedVirtualization
463463
}

environment/vm/lima/yaml.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func newConf(ctx context.Context, conf config.Config) (l limaconfig.Config, err
4444
}
4545
}
4646

47-
if util.MacOS15OrNewer() {
47+
if util.MacOSNestedVirtualizationSupported() {
4848
l.NestedVirtualization = conf.NestedVirtualization
4949
}
5050
}

util/macos.go

+5
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ func MacOS13OrNewer() bool { return minMacOSVersion("13.0.0") }
2929
// MacOS15OrNewer returns if the current OS is macOS 15 or newer.
3030
func MacOS15OrNewer() bool { return minMacOSVersion("15.0.0") }
3131

32+
// MacOSNestedVirtualizationSupported returns if the current device supports nested virtualization.
33+
func MacOSNestedVirtualizationSupported() bool {
34+
return M3() && MacOS15OrNewer()
35+
}
36+
3237
func minMacOSVersion(version string) bool {
3338
if !MacOS() {
3439
return false

0 commit comments

Comments
 (0)