# Code to enable SIP via MacOS VM project from WWDC

**URL:** <https://forums.kodeco.com/t/code-to-enable-sip-via-macos-vm-project-from-wwdc/189676>\
**Category:** Advanced Apple Debugging\
**Created:** [July 21, 2023, 12:47pm UTC](https://forums.kodeco.com/t/code-to-enable-sip-via-macos-vm-project-from-wwdc/189676 "2023-07-21T12:47:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![cupofjoe](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/cupofjoe/32/110937_2.png) [@cupofjoe](https://forums.kodeco.com/u/cupofjoe)\
**Post date:** [July 21, 2023, 12:47pm UTC](https://forums.kodeco.com/t/code-to-enable-sip-via-macos-vm-project-from-wwdc/189676/1 "2023-07-21T12:47:31Z")

</div>

I’m just putting in the entire code here because I had compiler issues using what was there.

Just pasting in what was in the book and ‘assuming’ how it landed was giving me  
a compiler error: Type ‘(any Error)?’ has no member ‘failure’

Thought this might help someone.

```auto
    func startVirtualMachine() {
        let options = VZMacOSVirtualMachineStartOptions()
        options.startUpFromMacOSRecovery = true
        
        virtualMachine.start(options: options, completionHandler: { (error) in
            if let error {
                fatalError("Virtual machine failed to start with \(error)")
            }
        })
    }

```

Cheers,

Ed

I was building on MacOS 13 using Xcode 14.3.1. My # define lines were not working and I just commented out the MacOS 14 code to work around it. Not sure what is going on but it was a quick fix. I just want to hack my way thru this quickly as I’ve got too much work to do in my day job… lol

---

<div class="post-metadata">

**Author:** ![infenet](https://s3.amazonaws.com/cdn.raywenderlich.com/community/forum-assets/noun-game-ghost-878668.png) [@infenet](https://forums.kodeco.com/u/infenet)\
**Post date:** [November 19, 2023, 1:48am UTC](https://forums.kodeco.com/t/code-to-enable-sip-via-macos-vm-project-from-wwdc/189676/2 "2023-11-19T01:48:58Z")

</div>

Helped me. Thank you!

---

<div class="post-metadata">

**Author:** ![system](https://s3.amazonaws.com/cdn.raywenderlich.com/community/forum-assets/noun-game-ghost-878668.png) [@system](https://forums.kodeco.com/u/system)\
**Post date:** [January 4, 2024, 4:47am UTC](https://forums.kodeco.com/t/code-to-enable-sip-via-macos-vm-project-from-wwdc/189676/3 "2024-01-04T04:47:58Z")

</div>

This topic was automatically closed after 166 days. New replies are no longer allowed.
