ADC Home > Reference Library > Reference > Mac OS X > Mac OS X Man Pages


This document is a Mac OS X manual page. Manual pages are a command-line technology for providing documentation. You can view these manual pages locally using the man(1) command. These manual pages come from many different sources, and thus, have a variety of writing styles.

For more information about the manual page format, see the manual page for manpages(5).

ARCH(1)                   BSD General Commands Manual                  ARCH(1)

     arch -- print architecture type or run selected architecture of a universal binary

     arch [-h] [[-arch_name | -arch arch_name]...] prog [args ...]

     The arch command with no arguments, displays the machine's architecture type.

     The other use of the arch command it to run a selected architecture of a universal binary.  A universal
     binary contains code that can run on different architectures.  By default, the operating system will
     select the architecture that most closely matches the processor type.  This means that an intel archi-tecture architecture
     tecture is selected on intel processors and a powerpc architecture is selected on powerpc processors.
     A 64-bit architecuture is preferred over a 32-bit architecture on a 64-bit processor, while only 32-bit
     architectures can run on a 32-bit processor.

     When the most natural architecture is unavailable, the operating system will try to pick another archi-tecture. architecture.
     tecture.  On 64-bit processors, a 32-bit architecture is tried.  If this is also unavailable, the oper-ating operating
     ating system on an intel processor will try running a 32-bit powerpc architecture.  Otherwise, no
     architecture is run, and an error results.

     The arch command can be use to alter the operating system's normal selection order.  The most common
     use is to select the 32-bit architecture on a 64-bit processor, even if a 64-bit architecture is avail-able. available.

     The -h option prints a usage message and exits.

     The arch_name argument must be one of the currently supported architectures:

           i386    32-bit intel

           ppc     32-bit powerpc

           ppc64   64-bit powerpc

           x86_64  64-bit intel

     Either prefix the architecture with a hyphen, or (for compatibility with other commands), use -arch
     followed by the architecture.

     If more than one architecture is specified, the operating system will try each one in order, skipping
     an architecture that is not supported on the current processor, or is unavailable in the universal

     The prog argument is the command to run, followed by any arguments to pass to the command.  It can be a
     full or partial path, while a lone name will be lookup in the user's command search path.

     If no architectures are specified on the command line, the arch command takes the basename of the prog
     argument and searches for the first property list file with that basename and the .plist suffix, in the
     archSettings sub-directory in each of the standard domains, in the following order:

           ~/Library/archSettings         User settings

           /Library/archSettings          Local settings

           /Network/Library/archSettings  Network settings

           /System/Library/archSettings   System settings

     This property list contains the architecture order preferences, as well as the full path to the real
     executable.  For examples of the property list format, look at the files in

     On an intel processor:

           % perl -MConfig -e 'printf "%s\n", $Config{byteorder}'

     shows the intel little endian byte order, while:

           % arch -ppc perl -MConfig -e 'printf "%s\n", $Config{byteorder}'

     runs the powerpc architecture, and displays big endian byte order.

   Making links to the arch command
     When a link is made to arch command with a different name, that name is used to find the corresponding
     property list file.  Thus, other commands can be wrapped so that they have custom architecture selec-tion selection
     tion order.

     Because of some internal logic in the code, hard links to the arch command may not work quite right.
     It is best to avoid using hard links, and only use symbolic links to the arch command.

     The environment variable ARCHPREFERENCE can be used to provide architecture order preferences.  It is
     checked before looking for the corresponding property list file.

     The value of the environment variable ARCHPREFERENCE is composed of one or more specifiers, separated
     by semicolons.  A specifier is made up of one, two or three fields, separated by colons.  Architectures
     specified in order, are separated by commas and make up the last (mandatory) field.  The first field,
     if specified, is a name of a program, which selects this specifier if that name matches the program
     name in question.  If the name field is empty or there is no name field, the specifier matches any pro-gram program
     gram name.  Thus, ordering of specifiers is important, and the one with no name should be last.

     When the arch command is called directly, the prog name provides the path information to the executable
     (possibly via the command search path).  When a name is specified in a ARCHPREFERENCE specifier, the
     path information can alternately be specified as a second field following the name.  When the arch com-mand command
     mand is called indirectly via a link, this path information must be specified.  If not specified as a
     second field in a specifier, the executable path will be looked up in the corresponding property list

   Example ARCHPREFERENCE Values
           A specifier that matches any name.

           A specifier that matches the program named foo (the full executable path is in the foo.plist

           A specifier with all fields specified.

           A specifier for baz and a second specifier that would match any other name.

     Running the arch command on an interpreter script may not work if the interpreter is a link to the arch
     command, especially if a 64-bit architecture is specified (since the arch command is 2-way universal,
     32-bit only).


Mac OS X                       November 12, 2006                      Mac OS X

Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.