Open in Colab: https://colab.research.google.com/github/casangi/examples/blob/master/community/install_modular_casa_mac_arm.ipynb


Open In Colab

Installing Modular CASA on Mac (M1/M2/M3) using Miniconda and Python 3.8

Original author: Travis Thieme (ASIAA)

This is a small guide on how to install the Modular version of CASA (6.5.1.23 at time of writing). This was succesfully done on a Macbook Pro with the M3 Max chip and macOS 14.3.

1. Change and check the terminal architecture

Since CASA has no native ARM version for the new Mac M1/M2/M3 processors, the modular installation of CASA is required to run on the x86_64 Intel architecture. Thus, you MUST use a Rosetta Terminal to access the x86_64 architecture on M1/M2/M3 Macs. Go to the location terminal app in the Finder app on your mac, right click and select “Get Info”, then select the box labeled “Open using Rosetta”. Close the terminal and reopen. You can then check the terminal architecture by running

username@MacBook-Pro % uname -m

which should then return

x86_64

if Rosetta is correctly running.

If it returns

arm64

then you are not running x86_64 architecture via Rosetta.

2. Get miniconda3 for MacOSX-x86_64

Download from https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh and install to your desired location via

username@MacBook-Pro % sh ./Miniconda3-latest-MacOSX-x86_64.sh

Just follow the installation instructions and specify the desired location where you want miniconda to go.

3. Create a new conda environment for Python 3.8

username@MacBook-Pro % conda create -n py38 python=3.8 anaconda

Channels:
 - defaults
Platform: osx-64
Collecting package metadata (repodata.json): done
Solving environment: done

## Package Plan ##

  environment location: /Users/username/path/to/miniconda3/envs/py38

  added / updated specs:
    - anaconda
    - python=3.8

...(continued)...

Note: it should specify Platform: osx-64, and not Platform: arm-64 or something like that.

4. Activate your conda environment

username@MacBook-Pro % conda activate py38

5. Upgrade pip and wheel

username@MacBook-Pro % pip install --upgrade pip wheel

6. Install casatools, casatasks and casadata (for minimum installation)

(py38) username@MacBook-Pro % arch -x86_64 python3 -m pip install casatools==6.5.1.23
(py38) username@MacBook-Pro % arch -x86_64 python3 -m pip install casatasks==6.5.1.23
(py38) username@MacBook-Pro % arch -x86_64 python3 -m pip install casadata==2024.1.15

You should now see the conda environment name before your username.

Note: casadata is required, I could not import casatasks without it.

7. Test the installation by importing into ipython

(py38) username@MacBook-Pro % ipython

Python 3.8.18 (default, Sep 11 2023, 08:17:33)
Type 'copyright', 'credits' or 'license' for more information
IPython 8.12.2 -- An enhanced Interactive Python. Type '?' for help.

In [1]: from casatasks import immoments

In [2]:
[ ]: