1 macOS Environment
In this tab, we provide steps to install a data science environment on a computer running the macOS operating system.
For a series of walk through videos, please see:
https://www.youtube.com/watch?v=CnKpOwAFeIE&list=PL50Yqb_ZFDedUXLKmzMDdDiuFGEdokuck&index=1
Many readers may already have a Python installation on their computer. However, the installation may be outdated, missing packages, or incorrectly setup. Thus, we highly recommend re-installing the Python by following the guide below.
Please do not follow these instructions if you are on a Windows computer! Please select the Windows Environment Setup Guidelines.
1.1 Installing Xcode Command Line Tools (Xcode CLI) on macOS
First, we need to install Xcode CLI developer tools by:
- Opening
Terminal
- Found under
Applications
->Utilities
->Terminal.app
; - Or, by typing in “Spotlight” in the upper right-hand corner
Terminal
.
- Found under
- Once
Terminal
is open type:
sudo xcode-select --install
This will trigger an installation pop-up. Please follow the installer prompts.
To verify the success of the installation, type into
Terminal
:
git --version
1.2 Setting up Git
While in Terminal
, setup git
by typing:
git config --global user.name "FirstName LastName"
git config --global user.email netid@illinois.edu
where FirstName
and LastName
correspond to your full name and netid@illinois.edu
should be your Illinois e-mail address.
1.3 Installing Miniconda 3 on macOS
Next, we need to download and install Miniconda 3. We can approach the installation by either using the Terminal Installer or an Installer Package.
Please follow either the Terminal Installer or Installer Package approach. Do not perform both installation routines!
We will aim to install Miniconda 3 by using the terminal to handle the installation.
Please do the following:
- Opening
Terminal
- Found under
Applications
->Utilities
->Terminal.app
; - Or, by typing in “Spotlight” in the upper right-hand corner
Terminal
.
- Found under
- Depending on the Mac’s hardware, please select the appropriate installer:
Intel-powered Macs or Macs purchased before 2020
# Download the installer bash script for Intel Macs (any Macs before 2020) by:
curl -sL \
"https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh" > \
"Miniconda3.sh"
# Then, run the installer script by using:
bash Miniconda3.sh
Arm64-powered (M1, M2, etc.) Macs or Macs purchased during during or after 2020
# Download the installer bash script for arm64 Macs (any Macs post 2020) by:
curl -sL \
"https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-arm64.sh" > \
"Miniconda3.sh"
# Then, run the installer script by using:
bash Miniconda3.sh
- Ensure that
conda
was installed correctly and is up-to-date by typing:
conda update -n base -c defaults conda
We will aim to install Miniconda 3 by using an installer package (.pkg
) to handle the installation.
- Visit https://docs.conda.io/en/latest/miniconda.html.
- Depending on the Mac’s hardware, please select either:
- “Miniconda 3 MacOSX 64-bit pkg”1 if on an Intel Mac (Any Mac’s pre-2020)
- “Miniconda 3 MacOSX arm64 pkg”2 if on an M1/M2-powered Mac (Mac’s after 2020 - 2022)
- Open the downloaded installer.
- Follow the steps to completion.
- Open
Terminal
- Found under
Applications
->Utilities
->Terminal.app
; - Or, by typing in “Spotlight” in the upper right-hand corner
Terminal
.
- Found under
- Ensure that
conda
was installed correctly and is up-to-date by typing:
conda update -n base -c defaults conda
1.4 Installing the pre-defined conda Data Science environment on macOS
With the software prerequisites done, we will now download the configuration files needed to setup the data science environment.
# Download the Conda environment file
curl -Os \
"https://raw.githubusercontent.com/coatless-textbooks/sds/master/ds.yaml"
# Download the pip requirements file to filter software
curl -Os \
"https://raw.githubusercontent.com/coatless-textbooks/sds/master/requirements-ds.txt"
Finally, we will install the ds
environment for the course by typing:
# Create an environment called "ds" with packages installed.
conda env create -f ds.yaml
1.5 Using the Data Science (ds) Environment
Once done, the ds
conda environment can be used by typing in Terminal
:
# Change from "base"/global into ds environment
conda activate ds
To return to the global environment, type in Terminal
:
# Return to "base"/global environment
conda deactivate
The URL for the latest Miniconda 3 Intel (x86_64) is: https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.pkg↩︎
The URL for the latest Miniconda 3 M1 or M2 (arm64) is: https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-arm64.pkg↩︎