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
- Ned Deily (2014-05 )
8
+ Ned Deily (2012-06 )
9
9
10
- :Version: 2.7.15
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 ``:
66
+
67
+ ``--enable-universalsdk --with-universal-archs=intel-64 ``
65
68
69
+ or avoid using either.
66
70
67
- Building and using a universal binary of Python on Mac OS X
68
- ===========================================================
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
@@ -127,28 +135,29 @@ values are available:
127
135
* ``all ``: ``ppc ``, ``ppc64 ``, ``i386 ``, ``x86_64 ``
128
136
129
137
To build a universal binary that includes a 64-bit architecture, you must build
130
- 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
131
139
only be built with a 10.5 SDK because ``ppc64 `` support was only included with
132
- OS X 10.5. Although legacy ``ppc`` support was included with Xcode 3 on OS X
133
- 10.6, it was removed in Xcode 4, versions of which were released on OS X 10.6
134
- 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
135
143
following combinations of SDKs and universal-archs flavors are available:
136
144
137
145
* 10.4u SDK with Xcode 2 supports ``32-bit `` only
138
146
139
147
* 10.5 SDK with Xcode 3.1.x supports all flavors
140
148
141
- * 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 ``
142
151
143
- * 10.6 SDK with Xcode 4 supports ``intel`` only
152
+ * 10.6 SDK with Xcode 4 supports ``intel ``, `` intel-32 ``, and `` intel-64 ``
144
153
145
- * 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 ``
146
155
147
- * 10.8 and 10.9 SDKs with Xcode 5 support ``intel`` only
156
+ * 10.15 and later SDKs support ``intel-64 `` only
148
157
149
158
The makefile for a framework build will also install ``python2.7-32 ``
150
159
binaries when the universal architecture includes at least one 32-bit
151
- architecture (that is, for all flavors but ``64-bit``).
160
+ architecture (that is, for all flavors but ``64-bit `` and `` intel-64 `` ).
152
161
153
162
Running a specific architecture
154
163
...............................
@@ -161,39 +170,34 @@ Or to explicitly run in 32-bit mode, regardless of the machine hardware::
161
170
162
171
$ arch -i386 -ppc python
163
172
164
- NOTE: When you're using a framework install of Python this requires at least
165
- Python 2.7 or 3.2, in earlier versions the python (and pythonw) commands are
166
- wrapper tools that execute the real interpreter without ensuring that the
167
- real interpreter runs with the same architecture.
168
-
169
173
Using ``arch `` is not a perfect solution as the selected architecture will
170
174
not automatically carry through to subprocesses launched by programs and tests
171
175
under that Python. If you want to ensure that Python interpreters launched in
172
176
subprocesses also run in 32-bit-mode if the main interpreter does, use
173
177
a ``python2.7-32 `` binary and use the value of ``sys.executable `` as the
174
178
``subprocess `` ``Popen `` executable value.
175
179
176
- Building and using a framework-based Python on Mac OS X.
177
- ========================================================
180
+ Building and using a framework-based Python on macOS
181
+ ====================================================
178
182
179
183
180
184
1. Why would I want a framework Python instead of a normal static Python?
181
185
--------------------------------------------------------------------------
182
186
183
187
The main reason is because you want to create GUI programs in Python. With the
184
188
exception of X11/XDarwin-based GUI toolkits all GUI programs need to be run
185
- from a Mac OS X application bundle (".app").
189
+ from a macOS application bundle (".app").
186
190
187
191
While it is technically possible to create a .app without using frameworks you
188
192
will have to do the work yourself if you really want this.
189
193
190
194
A second reason for using frameworks is that they put Python-related items in
191
195
only two places: "/Library/Framework/Python.framework" and
192
- "/Applications/Python <VERSION>" where ``<VERSION>`` can be e.g. "3.4 ",
196
+ "/Applications/Python <VERSION>" where ``<VERSION> `` can be e.g. "3.8 ",
193
197
"2.7", etc. This simplifies matters for users installing
194
198
Python from a binary distribution if they want to get rid of it again. Moreover,
195
- due to the way frameworks work, a user without admin privileges can install a
196
- 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.
197
201
198
202
2. How does a framework Python differ from a normal static Python?
199
203
------------------------------------------------------------------
@@ -207,12 +211,12 @@ Versions/Current and you will see the familiar bin and lib directories.
207
211
3. Do I need extra packages?
208
212
----------------------------
209
213
210
- Yes, probably. If you want Tkinter support you need to get the OS X AquaTk
211
- distribution, this is installed by default on Mac OS X 10.4 or later. Be
212
- 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
213
217
10.6 have proven to be unstable. If possible, you should consider
214
- installing a newer version before building on OS X 10.6 or later, such as
215
- 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
216
220
are building with an SDK, ensure that the newer Tcl and Tk frameworks are
217
221
seen in the SDK's ``Library/Frameworks `` directory; you may need to
218
222
manually create symlinks to their installed location, ``/Library/Frameworks ``.
@@ -223,7 +227,7 @@ If you want Cocoa you need to get PyObjC.
223
227
-------------------------------------
224
228
225
229
This directory contains a Makefile that will create a couple of python-related
226
- applications (full-blown OS X .app applications, that is) in
230
+ applications (full-blown macOS .app applications, that is) in
227
231
"/Applications/Python <VERSION>", and a hidden helper application Python.app
228
232
inside the Python.framework, and unix tools including "python" into
229
233
/usr/local/bin. In addition it has a target "installmacsubtree" that installs
@@ -291,26 +295,25 @@ How do I create a binary distribution?
291
295
Download and unpack the source release from http://www.python.org/download/.
292
296
Go to the directory ``Mac/BuildScript ``. There you will find a script
293
297
``build-installer.py `` that does all the work. This will download and build
294
- a number of 3rd-party libaries , configures and builds a framework Python,
298
+ a number of 3rd-party libraries , configures and builds a framework Python,
295
299
installs it, creates the installer package files and then packs this in a
296
300
DMG image. The script also builds an HTML copy of the current Python
297
301
documentation set for this release for inclusion in the framework. The
298
302
installer package will create links to the documentation for use by IDLE,
299
303
pydoc, shell users, and Finder user.
300
304
301
305
The script will build a universal binary so you'll therefore have to run this
302
- script on Mac OS X 10.4 or later and with Xcode 2.1 or later installed.
306
+ script on macOS 10.4 or later and with Xcode 2.1 or later installed.
303
307
However, the Python build process itself has several build dependencies not
304
- available out of the box with OS X 10.4 so you may have to install
305
- additional software beyond what is provided with Xcode 2. OS X 10.5
306
- provides a recent enough system Python (in ``/usr/bin``) to build
307
- the Python documentation set. It should be possible to use SDKs and/or older
308
+ available out of the box with macOS 10.4 so you may have to install
309
+ additional software beyond what is provided with Xcode 2.
310
+ It should be possible to use SDKs and/or older
308
311
versions of Xcode to build installers that are compatible with older systems
309
312
on a newer system but this may not be completely foolproof so the resulting
310
313
executables, shared libraries, and ``.so `` bundles should be carefully
311
314
examined and tested on all supported systems for proper dynamic linking
312
315
dependencies. It is safest to build the distribution on a system running the
313
- minimum OS X version supported.
316
+ minimum macOS version supported.
314
317
315
318
All of this is normally done completely isolated in /tmp/_py, so it does not
316
319
use your normal build directory nor does it install into /.
@@ -344,7 +347,7 @@ Uninstalling a framework install, including the binary installer
344
347
345
348
Uninstalling a framework can be done by manually removing all bits that got installed.
346
349
That's true for both installations from source and installations using the binary installer.
347
- OS X does not provide a central uninstaller.
350
+ macOS does not provide a central uninstaller.
348
351
349
352
The main bit of a framework install is the framework itself, installed in
350
353
``/Library/Frameworks/Python.framework ``. This can contain multiple versions
0 commit comments