Equivalent of objcopy -0 binary for Mach-O object files in macOS?

I do that using a small Python script, included below:

import sys
from macholib.MachO import MachO
m = MachO(sys.argv[1])
__TEXT = (cmd for load_cmd, cmd, data in m.headers[0].commands
          if getattr(cmd, 'segname', '').rstrip('\0') == '__TEXT').next()
print '__TEXT segment: offset %x size %x' % (__TEXT.fileoff, __TEXT.filesize)
f = open(sys.argv[1], 'rb')
f.seek(__TEXT.fileoff)
open('__TEXT.bin', 'wb').write(f.read(__TEXT.filesize))

Save that code to a file named "extract.py" and run it like this:

python extract.py AppName

where AppName is the name of the file that holds the application program.

The program will generate a file called __TEXT.bin that holds the contents of the __TEXT segment (i.e. the executable code).