0.4. I M OSX: Nstalling On AC
0.4. I M OSX: Nstalling On AC
INSTALLING ON MAC OS X
All modern Macintosh computers use the Intel chip (like most Windows PCs). Older Macs used PowerPC
chips. You don’t need to understand the difference, because there’s just one Mac Python installer for all
Macs.
Visit python.org/download/ and download the Mac installer. It will be called something like Python 3.1
Mac Installer Disk Image, although the version number may vary. Be sure to download version 3.x, not
2.x.
Your browser should automatically mount the disk image and open a Finder window to show you the
contents. (If this doesn’t happen, you’ll need to find the disk image in your downloads folder and double-click
to mount it. It will be named something like python-3.1.dmg.) The disk image contains a number of text
files (Build.txt, License.txt, ReadMe.txt), and the actual installer package, Python.mpkg.
Double-click the Python.mpkg installer package to launch the Mac Python installer.
11
The first
page of the
installer
gives a brief
description
of Python
itself, then
refers you
to the
ReadMe.txt
file (which
you didn’t
read, did
you?) for
more details.
Click the
Continue
12
The next
page actually
contains
some
important
information:
Python
requires
Mac OS X
10.3 or
later. If you
are still
running Mac
OS X 10.2,
you should
really
upgrade.
Apple no
longer provides security updates for your operating system, and your computer is probably at risk if you
ever go online. Also, you can’t run Python 3.
13
Like all good
installers,
the Python
installer
displays the
software
license
agreement.
Python is
open
source, and
its license is
approved by
the Open
Source
Initiative.
Python has
had a
number of owners and sponsors throughout its history, each of which has left its mark on the software
license. But the end result is this: Python is open source, and you may use it on any platform, for any
purpose, without fee or obligation of reciprocity.
14
Due to
quirks in the
standard
Apple
installer
framework,
you must
“agree” to
the software
license in
order to
complete
the
installation.
Since Python
is open
source, you
are really
“agreeing” that the license is granting you additional rights, rather than taking them away.
15
The next
screen
allows you
to change
your install
location.
You must
install
Python on
your boot
drive, but
due to
limitations of
the installer,
it does not
enforce this.
In truth, I
have never
had the need to change the install location.
From this screen, you can also customize the installation to exclude certain features. If you want to do this,
click the Customize button; otherwise click the Install button.
16
If you
choose a
Custom
Install, the
installer will
present you
with the
following list
of features:
◦ Python
Framework. This is the guts of Python, and is both selected and disabled because it must be installed.
◦ GUI Applications includes IDLE, the graphical Python Shell which you will use throughout this book. I
strongly recommend keeping this option selected.
◦ UNIX command-line tools includes the command-line python3 application. I strongly recommend keeping
this option, too.
◦ Python Documentation contains much of the information on docs.python.org. Recommended if you are
on dialup or have limited Internet access.
◦ Shell profile updater controls whether to update your shell profile (used in Terminal.app) to ensure that
this version of Python is on the search path of your shell. You probably don’t need to change this.
◦ Fix system Python should not be changed. (It tells your Mac to use Python 3 as the default Python for all
scripts, including built-in system scripts from Apple. This would be very bad, since most of those scripts are
written for Python 2, and they would fail to run properly under Python 3.)
17
Because it
installs
system-wide
frameworks
and binaries
in /usr/
local/bin/,
the installer
will ask you
for an
administrative password. There is no way to install Mac Python without administrator privileges.
18
The installer
will display a
progress
meter while
it installs the
features
you’ve
selected.
Assuming all
went well,
the installer
will give you
a big green
checkmark
to tell you
that the
installation
completed
successfully.
19
Click the Close button to exit the installer.
20