Skip to content

Instantly share code, notes, and snippets.

import Foundation
// Open the Mach-O binary file
let path = "myprogram"
let file = fopen(path, "r")
// Read the Mach-O header
var header = mach_header()
fread(&header, MemoryLayout.size(ofValue: header), 1, file)