Skip to content

Instantly share code, notes, and snippets.

@xocialize
Created January 16, 2019 23:02
Show Gist options
  • Save xocialize/171ee3621df53b96ac58d91ae4d9bdf0 to your computer and use it in GitHub Desktop.
Save xocialize/171ee3621df53b96ac58d91ae4d9bdf0 to your computer and use it in GitHub Desktop.
Hardware ID mac os
//http://www.markcornelisse.nl/cocoa/cocoa-hardware-identifier-inside-os-x/
import Foundation
import IOKit
public var hardwareUUID: NSUUID = {
var hwUUIDBytes: [UInt8] = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
var ts = timespec(tv_sec: 0,tv_nsec: 0)
gethostuuid(&hwUUIDBytes, &ts)
return NSUUID(UUIDBytes: hwUUIDBytes)
}()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment