mac os show machine's architecture type or run selected architecture of a universal binary

arch [-32] [-64] [[-arch_name | -arch arch_name]] [-c] [-d envname][-e envname=value]... [-h] prog [args]

With no arguments, displays the machine's architecture type.

Run a selected architecture of a universal binary. The most common use is to select the 32-bit architecture on a 64-bit processor, even if a 64-bit architecture is available. arch_name

i386 32-bit intel
x86_64 64-bit intel
x86_64h 64-bit intel (haswell)
arm64 64-bit arm
arm64e 64-bit arm (Apple Silicon)
If more than one architecture is specified, each one is attempted in order, skipping an architecture that is not supported on the current processor, or is unavailable in the universal binary.
-32 Add the native 32-bit architecture to the list of architectures.
-64 Add the native 64-bit architecture to the list of architectures.
-c Clears the environment that will be passed to the command
-d envname Deletes the named environment variable be run.
-e envname=value Assigns the given value to the named environment variable in the environment that will be passed to the command to be run. existing environment with the same name will be replaced.
-h Help
prog full or partial path of the command to run, followed by any arguments.
A lone name will be looked up in the user's command search path.

If no architectures are specified on the command line, the arch command takes the basename of prog and searches for the first .plist 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.

When a symbolic link is made to arch it is used to find the .plist


$ARCHPREFERENCE provides order preferences before looking for the .plist. It 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.
If the name field is empty the specifier matches any program name. Thus, ordering of specifiers is important, and the one with no name should be last.

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 command 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 file. EXAMPLES archSettings Property List Format

                   ExecutablePath $execpath
                   PreferredOrder  x86_64 arm64 
                   PropertyListVersion 1.0

           A specifier that matches any name.

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

           A specifier with all fields specified.

           A specifier for baz and a second specifier that would match any other name.
SEE machine(1) BUGS: Running the arch command on an interpreter script may not work if the interpreter is a link to the arch command.