1 .\" Copyright (c) 1994 SigmaSoft, Th. Lockert
2 .\" All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
12 .\" 3. All advertising materials mentioning features or use of this software
13 .\" must display the following acknowledgement:
14 .\" This product includes software developed by SigmaSoft, Th. Lockert.
15 .\" 4. The name of the author may not be used to endorse or promote products
16 .\" derived from this software without specific prior written permission
18 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 .\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 .\" $OpenBSD: arch.1,v 1.2 1996/06/29 20:29:34 tholo Exp $
31 .\" Modifications made 8/20/97 (c) Apple Computer, Inc.
32 .\" Modifications made 11/12/06 (c) Apple Computer, Inc.
39 .Nd print architecture type or run selected architecture of a universal binary
46 .Oo Fl Ns Ar arch_name | Fl arch Ar arch_name Oc Ns ...
49 .Oo Fl d Ar envname Oc Ns ...
50 .Oo Fl e Ar envname=value Oc Ns ...
57 command with no arguments, displays the machine's architecture type.
61 command it to run a selected architecture of a universal binary.
62 A universal binary contains code that can run on different architectures.
63 By default, the operating system will select the architecture that most closely
64 matches the processor type.
65 This means that an intel architecture is selected on intel processors and a
66 powerpc architecture is selected on powerpc processors.
67 A 64-bit architecture is preferred over a 32-bit architecture on a 64-bit
68 processor, while only 32-bit architectures can run on a 32-bit processor.
70 When the most natural architecture is unavailable, the operating system will
71 try to pick another architecture.
72 On 64-bit processors, a 32-bit architecture is tried.
73 If this is also unavailable, the operating system on an intel processor will
74 try running a 32-bit powerpc architecture.
75 Otherwise, no architecture is run, and an error results.
79 command can be used to alter the operating system's normal selection order.
80 The most common use is to select the 32-bit architecture on a 64-bit processor,
81 even if a 64-bit architecture is available.
85 argument must be one of the currently supported architectures:
86 .Bl -tag -width x86_64 -offset indent
93 Either prefix the architecture with a hyphen, or (for compatibility with
96 followed by the architecture.
98 If more than one architecture is specified, the operating system will try each
99 one in order, skipping an architecture that is not supported on the current
100 processor, or is unavailable in the universal binary.
102 The other options are:
103 .Bl -tag -width ".Fl e Ar envname=value"
105 Add the native 32-bit architecture to the list of architectures.
107 Add the native 64-bit architecture to the list of architectures.
109 Clears the environment that will be passed to the command to be run.
111 Deletes the named environment variable from the environment that will be passed
112 to the command to be run.
113 .It Fl e Ar envname=value
114 Assigns the given value to the named environment variable in the environment
115 that will be passed to the command to be run.
116 Any existing environment variable with the same name will be replaced.
118 Prints a usage message and exits.
123 argument is the command to run, followed by any arguments to pass to the
125 It can be a full or partial path, while a lone name will be looked up in the user's
128 If no architectures are specified on the command line, the
130 command takes the basename of the
132 argument and searches for the first property list file with that basename and
137 sub-directory in each of the standard domains, in the following order:
138 .Bl -tag -width ".Pa /Network/Library/archSettings" -offset indent
139 .It ~/Library/archSettings
141 .It /Library/archSettings
143 .It /Network/Library/archSettings
145 .It /System/Library/archSettings
149 This property list contains the architecture order preferences, as well
150 as the full path to the real executable.
151 For examples of the property list format, look at the files in
152 .Pa /System/Library/archSettings .
154 On an intel processor:
155 .Bd -literal -offset indent
156 % perl -MConfig -e 'printf "%s\\n", $Config{byteorder}'
160 shows the intel little endian byte order.
161 .Ss Making links to the arch command
162 When a link is made to
164 command with a different name, that name is used to find
165 the corresponding property list file.
166 Thus, other commands can be wrapped so that they have custom architecture
169 Because of some internal logic in the code, hard links to the
171 command may not work quite right.
172 It is best to avoid using hard links, and only use symbolic links to the
176 The environment variable
178 can be used to provide architecture order preferences.
179 It is checked before looking for the corresponding property list file.
181 The value of the environment variable
183 is composed of one or more specifiers, separated by semicolons.
184 A specifier is made up of one, two or three fields, separated by colons.
185 Architectures specified in order, are separated by commas and make up the last
187 The first field, if specified, is a name of a program, which selects this
188 specifier if that name matches the program name in question.
189 If the name field is empty or there is no name field, the specifier matches
191 Thus, ordering of specifiers is important, and the one with no name should
196 command is called directly, the
198 name provides the path information to the executable (possibly via the command
200 When a name is specified in a
202 specifier, the path information can alternately be specified as a second
203 field following the name.
206 command is called indirectly via a link, this path information must be
208 If not specified as a second field in a specifier, the executable path will
209 be looked up in the corresponding property list file.
210 .Ss Example ARCHPREFERENCE Values
213 A specifier that matches any name.
215 A specifier that matches the program named
217 (the full executable path is in the
220 .It foo:/op/bin/boo:i386,x86_64
221 A specifier with all fields specified.
225 and a second specifier that would match any other name.
230 command on an interpreter script may not work if the interpreter is a link
231 to the arch command, especially if a 64-bit architecture is specified (since the
233 command is 2-way universal, 32-bit only).