1
- =========================
2
- Python on Mac OS X README
3
- =========================
1
+ ======================
2
+ Python on macOS README
3
+ ======================
4
4
5
5
:Authors:
6
6
Jack Jansen (2004-07),
7
7
Ronald Oussoren (2010-04),
8
8
Ned Deily (2012-06)
9
9
10
- :Version: 3.4.0
11
-
12
- This document provides a quick overview of some Mac OS X specific features in
10
+ This document provides a quick overview of some macOS specific features in
13
11
the Python distribution.
14
12
15
- OS X specific arguments to configure
16
- ====================================
13
+ macOS specific arguments to configure
14
+ =====================================
17
15
18
16
* ``--enable-framework[=DIR] ``
19
17
20
18
If this argument is specified the build will create a Python.framework rather
21
19
than a traditional Unix install. See the section
22
- _`Building and using a framework-based Python on Mac OS X ` for more
20
+ _`Building and using a framework-based Python on macOS ` for more
23
21
information on frameworks.
24
22
25
23
If the optional directory argument is specified the framework is installed
@@ -43,41 +41,51 @@ OS X specific arguments to configure
43
41
Create a universal binary build of Python. This can be used with both
44
42
regular and framework builds.
45
43
46
- The optional argument specifies which OS X SDK should be used to perform the
47
- build. If xcodebuild is available and configured, this defaults to
48
- the Xcode default MacOS X SDK, otherwise ``/Developer/SDKs/MacOSX.10.4u.sdk``
49
- if available or ``/`` if not. When building on OS X 10.5 or later, you can
50
- specify ``/`` to use the installed system headers rather than an SDK. As of
51
- OS X 10.9, you should install the optional system headers from the Command
52
- Line Tools component using ``xcode-select``::
53
-
54
- $ sudo xcode-select --install
55
-
56
- See the section _`Building and using a universal binary of Python on Mac OS X`
57
- for more information.
44
+ The optional argument specifies which macOS SDK should be used to perform the
45
+ build. In most cases on current systems, you do not need to specify PATH or
46
+ you can just use ``/ ``; the default MacOSX SDK for the active Xcode or Command
47
+ Line Tools developer directory will be used. See the macOS ``xcrun `` man page
48
+ for more information. Current versions of macOS and Xcode no longer install
49
+ system header files in their traditional locations, like ``/usr/include `` and
50
+ ``/System/Library/Frameworks ``; instead they are found within a MacOSX SDK.
51
+ The Apple-supplied build tools handle this transparently and current
52
+ versiona of Python now handle this as well. So it is no longer necessary,
53
+ and since macOS 10.14, no longer possible to force the installation of system
54
+ headers with ``xcode-select ``.
58
55
59
56
* ``--with-universal-archs=VALUE ``
60
57
61
58
Specify the kind of universal binary that should be created. This option is
62
59
only valid when ``--enable-universalsdk `` is specified. The default is
63
- ``32-bit`` if a building with a SDK that supports PPC, otherwise defaults
64
- to ``intel``.
60
+ ``32-bit `` if building with a SDK that supports PPC, otherwise defaults
61
+ to ``intel ``. Note that ``intel `` means a universal build of both 32-bit
62
+ and 64-bit binaries and that may not be what you want; for example,
63
+ as of macOS 10.15 Catalina, 32-bit execution is no longer supported by
64
+ the operating system. Thus it is best to either explicitly specify
65
+ values for ``--with-universal-archs ``:
65
66
67
+ ``--enable-universalsdk --with-universal-archs=intel-64 ``
66
68
67
- Building and using a universal binary of Python on Mac OS X
68
- ===========================================================
69
+ or avoid using either.
70
+
71
+
72
+ Building and using a universal binary of Python on macOS
73
+ ========================================================
69
74
70
75
1. What is a universal binary
71
76
-----------------------------
72
77
73
78
A universal binary build of Python contains object code for more than one
74
- CPU architecture. A universal OS X executable file or library combines the
79
+ CPU architecture. A universal macOS executable file or library combines the
75
80
architecture-specific code into one file and can therefore run at native
76
81
speed on all supported architectures. Universal files were introduced in
77
- OS X 10.4 to add support for Intel-based Macs to the existing PowerPC (PPC)
78
- machines. In OS X 10.5 support was extended to 64-bit Intel and 64-bit PPC
82
+ macOS 10.4 to add support for Intel-based Macs to the existing PowerPC (PPC)
83
+ machines. In macOS 10.5 support was extended to 64-bit Intel and 64-bit PPC
79
84
architectures. It is possible to build Python with various combinations
80
- of architectures depending on the build tools and OS X version in use.
85
+ of architectures depending on the build tools and macOS version in use.
86
+ Note that PPC support was removed in macOS 10.7 and 32-bit Intel support
87
+ was removed in macOS 10.15. So currently as of macOS 10.15, macOS only
88
+ supports one execution architecture, 64-bit Intel (``x86_64 ``).
81
89
82
90
2. How do I build a universal binary
83
91
------------------------------------
@@ -90,14 +98,14 @@ flag to configure::
90
98
$ make install
91
99
92
100
This flag can be used with a framework build of python, but also with a classic
93
- unix build. Universal builds were first supported with OS X 10.4 with Xcode 2.1
94
- and the 10.4u SDK. Starting with Xcode 3 and OS X 10.5, more configurations are
101
+ unix build. Universal builds were first supported with macOS 10.4 with Xcode 2.1
102
+ and the 10.4u SDK. Starting with Xcode 3 and macOS 10.5, more configurations are
95
103
available.
96
104
97
105
In general, universal builds depend on specific features provided by the
98
106
Apple-supplied compilers and other build tools included in Apple's Xcode
99
- development tools. You should install Xcode and the command line tools
100
- component appropriate for the OS X release you are running on. See the
107
+ development tools. You should install Xcode or the command line tools
108
+ component appropriate for the macOS release you are running on. See the
101
109
Python Developer's Guide (https://devguide.python.org/setup/)
102
110
for more information.
103
111
@@ -116,6 +124,8 @@ values are available:
116
124
117
125
* ``intel-32 ``: ``i386 ``
118
126
127
+ * ``intel-64 ``: ``x86_64 ``
128
+
119
129
* ``32-bit ``: ``ppc ``, ``i386 ``
120
130
121
131
* ``3-way ``: ``i386 ``, ``x86_64 ``, ``ppc ``
@@ -125,28 +135,29 @@ values are available:
125
135
* ``all ``: ``ppc ``, ``ppc64 ``, ``i386 ``, ``x86_64 ``
126
136
127
137
To build a universal binary that includes a 64-bit architecture, you must build
128
- on a system running OS X 10.5 or later. The ``all`` and ``64-bit`` flavors can
138
+ on a system running macOS 10.5 or later. The ``all `` and ``64-bit `` flavors can
129
139
only be built with a 10.5 SDK because ``ppc64 `` support was only included with
130
- OS X 10.5. Although legacy ``ppc`` support was included with Xcode 3 on OS X
131
- 10.6, it was removed in Xcode 4, versions of which were released on OS X 10.6
132
- and which is the standard for OS X 10.7. To summarize, the
140
+ macOS 10.5. Although legacy ``ppc `` support was included with Xcode 3 on macOS
141
+ 10.6, it was removed in Xcode 4, versions of which were released on macOS 10.6
142
+ and which is the standard for macOS 10.7. To summarize, the
133
143
following combinations of SDKs and universal-archs flavors are available:
134
144
135
145
* 10.4u SDK with Xcode 2 supports ``32-bit `` only
136
146
137
147
* 10.5 SDK with Xcode 3.1.x supports all flavors
138
148
139
- * 10.6 SDK with Xcode 3.2.x supports ``intel``, ``3-way``, and ``32-bit``
149
+ * 10.6 SDK with Xcode 3.2.x supports ``intel ``, ``intel-32 ``,
150
+ ``intel-64 ``, ``3-way ``, and ``32-bit ``
140
151
141
- * 10.6 SDK with Xcode 4 supports ``intel`` only
152
+ * 10.6 SDK with Xcode 4 supports ``intel ``, `` intel-32 ``, and `` intel-64 ``
142
153
143
- * 10.7 and 10.8 SDKs with Xcode 4 support ``intel`` only
154
+ * 10.7 through 10.14 SDKs support `` intel ``, `` intel-32 ``, and ``intel-64 ``
144
155
145
- * 10.8 and 10.9 SDKs with Xcode 5 support ``intel`` only
156
+ * 10.15 and later SDKs support ``intel-64 `` only
146
157
147
- The makefile for a framework build will also install ``python3.4 -32``
158
+ The makefile for a framework build will also install ``python3.x -32 ``
148
159
binaries when the universal architecture includes at least one 32-bit
149
- architecture (that is, for all flavors but ``64-bit``).
160
+ architecture (that is, for all flavors but ``64-bit `` and `` intel-64 `` ).
150
161
151
162
Running a specific architecture
152
163
...............................
@@ -159,39 +170,34 @@ Or to explicitly run in 32-bit mode, regardless of the machine hardware::
159
170
160
171
$ arch -i386 -ppc python
161
172
162
- NOTE: When you're using a framework install of Python this requires at least
163
- Python 2.7 or 3.2, in earlier versions the python (and pythonw) commands are
164
- wrapper tools that execute the real interpreter without ensuring that the
165
- real interpreter runs with the same architecture.
166
-
167
173
Using ``arch `` is not a perfect solution as the selected architecture will
168
174
not automatically carry through to subprocesses launched by programs and tests
169
175
under that Python. If you want to ensure that Python interpreters launched in
170
176
subprocesses also run in 32-bit-mode if the main interpreter does, use
171
- a ``python3.4 -32`` binary and use the value of ``sys.executable`` as the
177
+ a ``python3.x -32 `` binary and use the value of ``sys.executable `` as the
172
178
``subprocess `` ``Popen `` executable value.
173
179
174
- Building and using a framework-based Python on Mac OS X.
175
- ========================================================
180
+ Building and using a framework-based Python on macOS
181
+ ====================================================
176
182
177
183
178
184
1. Why would I want a framework Python instead of a normal static Python?
179
185
--------------------------------------------------------------------------
180
186
181
187
The main reason is because you want to create GUI programs in Python. With the
182
188
exception of X11/XDarwin-based GUI toolkits all GUI programs need to be run
183
- from a Mac OS X application bundle (".app").
189
+ from a macOS application bundle (".app").
184
190
185
191
While it is technically possible to create a .app without using frameworks you
186
192
will have to do the work yourself if you really want this.
187
193
188
194
A second reason for using frameworks is that they put Python-related items in
189
195
only two places: "/Library/Framework/Python.framework" and
190
- "/Applications/Python <VERSION>" where ``<VERSION>`` can be e.g. "3.4 ",
196
+ "/Applications/Python <VERSION>" where ``<VERSION> `` can be e.g. "3.8 ",
191
197
"2.7", etc. This simplifies matters for users installing
192
198
Python from a binary distribution if they want to get rid of it again. Moreover,
193
- due to the way frameworks work, a user without admin privileges can install a
194
- binary distribution in his or her home directory without recompilation.
199
+ due to the way frameworks work, usera without admin privileges can install a
200
+ binary distribution in their home directory without recompilation.
195
201
196
202
2. How does a framework Python differ from a normal static Python?
197
203
------------------------------------------------------------------
@@ -205,12 +211,12 @@ Versions/Current and you will see the familiar bin and lib directories.
205
211
3. Do I need extra packages?
206
212
----------------------------
207
213
208
- Yes, probably. If you want Tkinter support you need to get the OS X AquaTk
209
- distribution, this is installed by default on Mac OS X 10.4 or later. Be
210
- aware, though, that the Cocoa-based AquaTk's supplied starting with OS X
214
+ Yes, probably. If you want Tkinter support you need to get the macOS AquaTk
215
+ distribution, this is installed by default on macOS 10.4 or later. Be
216
+ aware, though, that the Cocoa-based AquaTk's supplied starting with macOS
211
217
10.6 have proven to be unstable. If possible, you should consider
212
- installing a newer version before building on OS X 10.6 or later, such as
213
- the ActiveTcl 8.5 . See http://www.python.org/download/mac/tcltk/. If you
218
+ installing a newer version before building on macOS 10.6 or later, such as
219
+ the ActiveTcl 8.6 . See http://www.python.org/download/mac/tcltk/. If you
214
220
are building with an SDK, ensure that the newer Tcl and Tk frameworks are
215
221
seen in the SDK's ``Library/Frameworks `` directory; you may need to
216
222
manually create symlinks to their installed location, ``/Library/Frameworks ``.
@@ -221,7 +227,7 @@ If you want Cocoa you need to get PyObjC.
221
227
-------------------------------------
222
228
223
229
This directory contains a Makefile that will create a couple of python-related
224
- applications (full-blown OS X .app applications, that is) in
230
+ applications (full-blown macOS .app applications, that is) in
225
231
"/Applications/Python <VERSION>", and a hidden helper application Python.app
226
232
inside the Python.framework, and unix tools including "python" into
227
233
/usr/local/bin. In addition it has a target "installmacsubtree" that installs
@@ -271,7 +277,7 @@ through Python Launcher's preferences dialog.
271
277
272
278
The program ``pythonx.x `` runs python scripts from the command line.
273
279
Previously, various compatibility aliases were also installed, including
274
- ``pythonwx.x`` which in early releases of Python on OS X was required to run
280
+ ``pythonwx.x `` which in early releases of Python on macOS was required to run
275
281
GUI programs. As of 3.4.0, the ``pythonwx.x `` aliases are no longer installed.
276
282
277
283
How do I create a binary distribution?
@@ -288,18 +294,17 @@ installer package will create links to the documentation for use by IDLE,
288
294
pydoc, shell users, and Finder user.
289
295
290
296
The script will build a universal binary so you'll therefore have to run this
291
- script on Mac OS X 10.4 or later and with Xcode 2.1 or later installed.
297
+ script on macOS 10.4 or later and with Xcode 2.1 or later installed.
292
298
However, the Python build process itself has several build dependencies not
293
- available out of the box with OS X 10.4 so you may have to install
294
- additional software beyond what is provided with Xcode 2. OS X 10.5
295
- provides a recent enough system Python (in ``/usr/bin``) to build
296
- the Python documentation set. It should be possible to use SDKs and/or older
299
+ available out of the box with macOS 10.4 so you may have to install
300
+ additional software beyond what is provided with Xcode 2.
301
+ It should be possible to use SDKs and/or older
297
302
versions of Xcode to build installers that are compatible with older systems
298
303
on a newer system but this may not be completely foolproof so the resulting
299
304
executables, shared libraries, and ``.so `` bundles should be carefully
300
305
examined and tested on all supported systems for proper dynamic linking
301
306
dependencies. It is safest to build the distribution on a system running the
302
- minimum OS X version supported.
307
+ minimum macOS version supported.
303
308
304
309
All of this is normally done completely isolated in /tmp/_py, so it does not
305
310
use your normal build directory nor does it install into /.
@@ -333,7 +338,7 @@ Uninstalling a framework install, including the binary installer
333
338
334
339
Uninstalling a framework can be done by manually removing all bits that got installed.
335
340
That's true for both installations from source and installations using the binary installer.
336
- OS X does not provide a central uninstaller.
341
+ macOS does not provide a central uninstaller.
337
342
338
343
The main bit of a framework install is the framework itself, installed in
339
344
``/Library/Frameworks/Python.framework ``. This can contain multiple versions
0 commit comments