Equivalent of objcopy -O binary <FILE> <FILE>.bin
for Mach-O object files in macOS?
I want to dump the executable code in the __TEXT
segment to a flat binary file on macOS.
This can be accomplished on Linux as follows:
objcopy -O binary <FILE> <FILE>.bin
, where <FILE>
would be an ELF file.
However, since objcopy
isn't available (or very poorly supported) on macOS (e.g. llvm-objcopy
cannot handle Mach-O objects), how can I achieve the same result?