Installing ActivePython for macOS

You can install the macOS package using the standard user interface, or by using the command line.

ActivePython is distributed on macOS as a disk image (.dmg file). The disk image contains an installer package (.pkg bundle) that you run to install ActivePython.

Before you begin

Before you start the installation, you need to ensure that your system meets the prerequisites, and that you do not have other Python distributions that are going to conflict with ActivePython.

Prerequisites

  • Hardware: 65 MD hard disk space
  • Operating System: macOS 10.6 (Snow Leopard) or later

Existing Python installations

In general, ActivePython can co-exist with these other Python installations.

  1. Only one Python can be first on your PATH environment variable at a time. This determines which Python is run when you type python or pythonw in Terminal. ActivePython configures symlinks for python, pythonw, and versioned ones (e.g. python3.6 and pythonw3.6) in /usr/local/bin. You can ensure that ActivePython is first on your PATH in the terminal by including the following in your ~/.bashrc file (if you use Bash as your shell, which is the default on macOS 10.3 and later):
export PATH=/usr/local/bin:$PATH

Enter the following in ~/csh.cshrc if you use the tcsh shell:

setenv PATH /usr/local/bin:$PATH

Note that this will only affect your PATH in the shell. You must complete additional configuration to change your system path (e.g. if you need you environment changes to exist for GUI apps). You must modify your environment.plist file, or complete the equivalent steps for your version of macOS. Contact support@activestate.com if you need assistance with this configuration.

  1. Both ActivePython and MacPython (another Python distribution for macOS) install to the same location on disk (/Library/Frameworks/Python.framework/... with some links in /usr/local/bin), therefore ActivePython and MacPython installations of the same versions can collide. The ActivePython installer will properly install over a MacPython installation of the same version. However it is recommended that you first uninstall MacPython 3.6 before installing ActivePython 3.6.

Installing with Package

  1. Download the ActivePython disk image (ActivePython-<version>-macosx.dmg).
  2. If the browser does not automatically mount the disk image and open the mounted folder in Finder, double-click ActivePython-<version>-macosx.dmg to do so.
  3. Double-click the ActivePython installer package (ActivePython-3.6.pkg) to start the installation.
  4. Follow the Installer prompts. The installer will ask for administrative authentication if the current user does not have administrative privileges.
  5. After installation is complete, you may eject the ActivePython disk image and move ActivePython-<version>-macosx.dmg to the Trash. ActivePython installs a python link in /usr/local/bin. By default this directory is not on your PATH environment variable. Refer to Getting Started on macOS in this guide for instructions on putting python on your path and for a general introduction to ActivePython on macOS.

Installing with the Package command line tool

macOS includes a command-line tool, installer, for installing macOS packages non-interactively from the command line. This can be useful for remote administration (e.g. on Apple Xserve hardware).

  1. Download the ActivePython disk image (ActivePython-<version>-macosx.dmg).

  2. If the browser does not automatically mount the disk image, mount it manually with the following command:

    hdiutil attach path/to/ActivePython-<version>-macosx.dmg
    
  3. Install ActivePython:

    sudo installer -pkg /Volumes/ActivePython-3.6/ActivePython-3.6.pkg -target /
    

    Note: It is sometimes useful to create an install log file (e.g. to send to ActiveState technical support). To do this, use the -verbose and -dumplog flags:

    sudo installer -pkg /Volumes/ActivePython-3.6/ActivePython-3.6.pkg \
    -target / -verbose -dumplog > install.log 2>&1
    
  4. Unmount the ActivePython disk image:

    hdiutil unmount /Volumes/ActivePython-3.6
    

ActivePython installs a python link in /usr/local/bin. By default this directory is not on your PATH environment variable. Refer to Getting started with ActivePython on macOS in this guide for instructions on putting python on your path and for a general introduction to ActivePython on macOS.

Uninstalling the macOS Package

Apple does not provide a standard uninstallation tool or mechanism. You may, however, use the uninstall script that comes with ActivePython to uninstall ActivePython:

sudo /Library/Frameworks/Python.framework/Versions/3.6/Resources/Scripts/uninstall

Note: ActivePython’s uninstall will restore an older Python installation in /Library/Frameworks/Python.framework if one exists (using pythonselect). This means, for example, that if you initially have ActivePython 3.4 installed, and then install and uninstall ActivePython 3.6, your original ActivePython 3.4 will be restored to its full working state.