title: trying to run kextutil on kext file returns permissions error
body: <p>Hi Stackoverflow Community.</p>
  <p>Trying to run through the following tutorial - so I can learn how to code a driver util.<br />
  <a href="http://www.robertopasini.com/index.php/2-uncategorised/625-osx-creating-a-device-driver" rel="nofollow noreferrer">http://www.robertopasini.com/index.php/2-uncategorised/625-osx-creating-a-device-driver</a></p>
  <p>I'm at the point where I'm trying to run kextutil on the kext file that my build produces.
  Per the instructions I copy it to my temp folder.
  But I'm getting the following error:</p>
  <pre><code>admins-Mac-mini:Debug admin$ kextutil -n -t /tmp/ssvac.kext
  Skipping staging and system policy checks because not running as root, expect staging errors.
  Kext rejected due to improper filesystem permissions: &lt;OSKext 0x7f91d402f140 [0x7fff898b2cc0]&gt; { URL = &quot;file:///private/tmp/ssvac.kext/&quot;, ID = &quot;myappleid.ssvac&quot; }
  Code Signing Failure: code signature is invalid
  Authentication Failures: 
      File owner/permissions are incorrect (must be root:wheel, nonwritable by group/other): 
          /private/tmp/ssvac.kext
          Contents
          _CodeSignature
          CodeResources
          MacOS
          ssvac
          Info.plist
  
  Diagnostics for /private/tmp/ssvac.kext:
  Authentication Failures: 
      File owner/permissions are incorrect (must be root:wheel, nonwritable by group/other): 
          /private/tmp/ssvac.kext
          Contents
          _CodeSignature
          CodeResources
          MacOS
          ssvac
          Info.plist
  
  admins-Mac-mini:Debug admin$ 
  </code></pre>
  <p>I tried to change the permissions / owner like so:</p>
  <pre><code>admins-Mac-mini:Debug admin$ chown root:wheel /tmp/ssvac.kext/
  
  admins-Mac-mini:Debug admin$ ls -lah /tmp/ssvac.kext/
  total 0
  drwxrwxrwx  3 root   wheel    96B 16 Oct 16:37 .
  drwxrwxrwt  7 root   wheel   224B 19 Oct 08:08 ..
  drwxr-xr-x  5 admin  wheel   160B 16 Oct 16:37 Contents
  admins-Mac-mini:Debug admin$ kextutil -n -t /tmp/ssvac.kext
  </code></pre>
  <p>Not sure exactly how to resolve it.
  If you have any tips, I'd appreciate it.</p>
  <p>Thanks!</p>
  <p>EDIT 1</p>
  <pre><code>My mistake was when I copied from the debug folder to /tmp/, I didn't use the -r switch.  Now that I have, this is the error I'm getting: 
  
  admins-Mac-mini:Debug admin$ cp -r ssvac.kext/ /tmp/
  admins-Mac-mini:Debug admin$ sudo kextutil /tmp/
  Contents/                     com.apple.launchd.GufwRL5Sf0/ com.google.Keystone/          powerlog/                     ssvac.kext/
  admins-Mac-mini:Debug admin$ sudo kextutil /tmp/ssvac.kext/
  Password:
  Untrusted kexts are not allowed
  Kext with invalid signature (-67050) denied: /private/var/db/KernelExtensionManagement/Staging/tmp.RLlmC1/59AFE9EA-12E3-42C0-B3FC-E98EF987D9B2.kext
  Bundle (/private/tmp/ssvac.kext) failed to validate, deleting: /private/var/db/KernelExtensionManagement/Staging/tmp.RLlmC1/59AFE9EA-12E3-42C0-B3FC-E98EF987D9B2.kext
  Unable to stage kext (/private/tmp/ssvac.kext) to secure location.
  admins-Mac-mini:Debug admin$ 
  </code></pre>