===========================
Anaconda for macOS install
===========================

You can install Anaconda for macOS using either the graphical interface or the command line.

macOS graphical install
===========================

#. Download the `Anaconda installer <http://continuum.io/downloads.html>`_.

#. Optional: :doc:`Verify data integrity with MD5 or SHA-256 <hashes/index>`.
   (For more information on hashes, see `cryptographic hash validation <http://conda.pydata.org/docs/download.html#what-about-cryptographic-hash-verification>`_.)

#. Double-click the downloaded .pkg installer. Answer the prompts on 
   Introduction, Read Me, and License screens.

#. Click Agree to agree to the terms of the software license agreement.

#. On Installation Type you can choose to install in another location. 
   Default puts Anaconda in your home user directory.

   |

   .. image:: /img/customizebutton.png

   |

   NOTE: Advanced users may select "customize" to not add Anaconda to the Bash path:

   |

   .. image:: /img/pathoption.png

   |
   
#. If you click "Change Install Location", the installer will take you to the 
   Destination Select screen, where you should select "Install for me only."
   
   IMPORTANT: If you get an error message, reselect "Install for me only".
   |
   
   .. image:: /img/osxbug2.png

   |

#. Click Install. Once finished, the installer should display a success window:

   .. image:: /img/anaconda-install-osx.png

#. Click Close to exit the installer. 

When your install is complete, start using Anaconda with the instructions in :ref:`next`.

macOS command line install
===========================
Perform all command line entry in Apple's Terminal app (or equivalent). 

#. Go to the `Download Anaconda <https://www.continuum.io/downloads>`_ page. 

#. On the right of the **Download for macOS** tab, click the command line installer 
   link for either Anaconda with Python 2.7 or Anaconda with Python 3.6.

#. Optional: Verify data integrity with MD5 or SHA-256 hashes.

   (For more info on hashes, see `cryptographic hash validation <http://conda.pydata.org/docs/download.html#what-about-cryptographic-hash-verification>`_.)
   
   #. Run the following::
   
        md5 /path/filename 

      OR::

        shasum -a 256 /path/filename

   #. Verify results against :ref:`the proper hash page<anaconda-hashes-macos>` to make sure the hashes match.
   
#. Run the following (being sure to replace the path if it's in 
   a different directory, and change the filename if you've downloaded 
   a different package):

   - For Python 2.7 enter::
  
      bash ~/Downloads/Anaconda2-4.3.1-MacOSX-x86_64.sh

   - For Python 3.6 enter::

      bash ~/Downloads/Anaconda3-4.3.1-MacOSX-x86_64.sh

   NOTE: You should include the ``bash`` command regardless of whether you are 
   using Bash shell.

#. The installer prompts "In order to continue the installation process, 
   please review the license agreement." Click Enter to view license terms.

#. Scroll to the bottom of the instructions and enter ``yes`` to agree to 
   the license terms.

#. You will be prompted to click Enter to accept the default install location, 
   cancel the installation, or choose an alternate installation directory. 
   If you accept the default install location, the installer displays 
   "PREFIX=/Users/<your user name>/anaconda3" and continues the installation. 
   It may take a few minutes for the installer to finish.  

#. The installer prompts "Do you wish the installer to prepend the Anaconda<2 or 3> 
   install location to PATH in your /Users/<your user name>/.bash_profile ?" Enter ``yes``. 
   
   NOTE: If you enter "no", you will need to edit .bash_profile to add ~/anaconda3/bin 
   to your path manually using::
   
      export PATH="/Users/username/anaconda3/bin:$PATH"

   Replace /Users/username/anaconda3 with the actual path.

   Alternately, you will need to run all Anaconda commands explicitly from that path.

#. The installer finishes "For this change to become active, you have to open a new terminal." 

#. Open a new Terminal window and enter ``conda list``. If the installation was successful, 
   the Terminal window should display a list of installed Anaconda packages. 
   
When your install is complete, start using Anaconda with the instructions in :ref:`next`

NOTE: If you install multiple versions of Anaconda, the system should always default to
the most current version, as long as you haven't altered the default install path. 
