Installing ActivePython for macOS

Installing ActivePython using the State Tool (beta)

The State Tool is the command line interface (CLI) for the ActiveState Platform. You can use it to authenticate with the Platform, and then download and configure your ActivePython 3.5 runtime environment.

  1. If you don’t already have the State Tool installed, open your command prompt and run the following command to set it up:

    sh <(curl -q https://platform.activestate.com/dl/cli/install.sh)
    

    You can specify the directory to install the State Tool into using the -t flag.

    sh <(curl -q https://platform.activestate.com/dl/cli/install.sh) -t ~/bin
    

    Follow the prompts in the command prompt and then open a new command prompt or source your .bash_profile file (source ~/.bash_profile) to complete the installation and configuration.

  2. Run state activate ActiveState/ActivePython-3.5. This command downloads the runtime environment from the ActiveState Platform, configures it, and creates an “activated state”, an isolated environment for you to work in.

Installing ActivePython using the macOS package installer

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

ActivePython is distributed on macOS as an installer package (.pkg) file 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: 1 GB hard disk space
  • Operating System: macOS 10.6 (Snow Leopard) or later

macOS Gatekeeper

You may encounter warning messages from the Gatekeeper utility in macOS when you attempt to run some ActiveState installers. In particular, this may happen when you download and run the installer for a custom runtime you created on the ActiveState Platform.

If you encounter this warning, you will see a message similar to the following:

If you downloaded the installer from the ActiveState Platform, you can continue with the installation by creating an exception to run the installer.

Use Launchpad to open System Preferences, and then double-click Security & Privacy and choose the General tab. The warning message for the installer package should be displayed, and you can click Open Anyway to open the installer and continue with the installation.

TIP: Alternatively, you can Ctrl+click the .pkg file in Explorer and select Open to bypass the warning message and run the installer.

The warning message for the package installer is displayed again, but you have the option to Open it now.

See this Apple support article for more information about Gatekeeper: Safely open apps on your Mac.

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 python3 or pythonw in Terminal. ActivePython configures symlinks for python3, pythonw, and versioned ones (e.g. python2.7 and pythonw2.7) 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.

  2. 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.5 before installing ActivePython 3.5.

Installing with Package

  1. Download the ActivePython installer package (ActivePython-<version>-macosx.pkg).
  2. Double-click the ActivePython installer package (ActivePython-<version>.pkg) to start the installation.
  3. Follow the Installer prompts. The installer will ask for administrative authentication if the current user does not have administrative privileges.

    ActivePython installs a python3 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 python3 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.

  1. Download the ActivePython installer package (ActivePython-<version>-macosx.pkg).

  2. Install ActivePython:

    sudo installer -pkg /Volumes/ActivePython-3.5/ActivePython-3.5.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.5/ActivePython-3.5.pkg \
    -target / -verbose -dumplog > install.log 2>&1
    

ActivePython installs a python3 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 python3 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.5/Resources/Scripts/uninstall

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