Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

Many of the unix executable binary programs are delivered with more than one architecture:

mac:~ mike$ file `which bc`
/usr/bin/bc: Mach-O universal binary with 2 architectures
/usr/bin/bc (for architecture x86_64):  Mach-O 64-bit executable x86_64
/usr/bin/bc (for architecture i386):    Mach-O executable i386

Is there a way I can select or force a specific architecture to run (mainly for testing to explore the effects that some larger programs or longer running processes have when executing the same workload over different codebases / memory capabilities?)

share|improve this question

1 Answer 1

up vote 7 down vote accepted

You can use the arch program to select which architecture of a universal binary to run.

If you wanted to use the 32-bit version of the executable:

arch -arch i386 /usr/bin/bc

And if you wanted the 64-bit version of the executable:

arch -arch x86_64 /usr/bin/bc

Note this doesn't work with applications (folders that end in .app and have manifests and what not so OS X recognizes them as applications), just universal binaries. If you had a app with multiple architectures you'd want to use Launch Services to launch it with a specific architecture.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.