2.6. macOS Setup

This guide provides macOS-specific instructions for installing and using Tiny ML Tensorlab on macOS 12 (Monterey) or later.

Note

Both Intel (x86_64) and Apple Silicon (M1/M2/M3) Macs are supported. All commands work on both architectures.

2.6.1. Prerequisites

Step 1: Install Homebrew

If you don’t have Homebrew installed:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Follow the prompts. Apple Silicon users must also add Homebrew to PATH:

echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"

Step 2: Install system dependencies

brew install git pyenv

Step 3: Configure pyenv

Add to ~/.zshrc (or ~/.bash_profile if using bash):

export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"

Reload the shell:

source ~/.zshrc

Step 4: Install Python 3.10

pyenv install 3.10.14
pyenv global 3.10.14

# Verify
python --version  # Should show Python 3.10.14

2.6.2. Installation

Step 1: Clone the repository

git clone https://github.com/TexasInstruments/tinyml-tensorlab.git
cd tinyml-tensorlab

Step 2: Create a virtual environment

python -m venv venv
source venv/bin/activate

Step 3: Upgrade pip and build tools

python -m pip install --upgrade pip setuptools wheel

Step 4: Install Tiny ML Tensorlab components

pip install -e tinyml-modelmaker
pip install -e tinyml-tinyverse
pip install -e tinyml-modeloptimization/torchmodelopt
pip install -e tinyml-modelzoo

Alternatively, use the setup script:

cd tinyml-modelmaker
./setup_all.sh

2.6.3. Environment Variables for Compilation

Environment variables are only needed if compiling models for TI MCU deployment. Training and testing work without them.

For MSPM0 and Connectivity devices:

export ARM_LLVM_CGT_PATH="$HOME/ti/arm-clang/4.0.0.LTS"

Add to ~/.zshrc for persistence.

See Environment Variables for complete device-specific instructions.

2.6.4. Running Examples

# Activate environment
source venv/bin/activate

# Run an example
cd tinyml-modelzoo
./run_tinyml_modelzoo.sh examples/generic_timeseries_classification/config.yaml

2.6.5. Verifying Installation

import tinyml_modelmaker
import tinyml_tinyverse
import tinyml_torchmodelopt
import tinyml_modelzoo

print(f"ModelMaker: {tinyml_modelmaker.__version__}")
print(f"Tinyverse: {tinyml_tinyverse.__version__}")
print(f"ModelOpt: {tinyml_torchmodelopt.__version__}")
print(f"ModelZoo: {tinyml_modelzoo.__version__}")

2.6.6. macOS-Specific Notes

Apple Silicon (M1/M2/M3)

PyTorch works natively on Apple Silicon via MPS backend. CPU training is used by default; GPU acceleration via MPS is not currently enabled in the training pipeline but does not affect correctness.

GPU / CUDA

CUDA is not available on macOS. Neural Architecture Search (NAS) runs on CPU, which is slower but fully functional.

OpenMP

Some operations use OpenMP. Install the runtime if needed:

brew install libomp

2.6.7. Troubleshooting

“SSL: CERTIFICATE_VERIFY_FAILED”

Run the Python certificate installer:

/Applications/Python\ 3.10/Install\ Certificates.command

Or via pip:

pip install certifi
/usr/local/opt/python@3.10/bin/python3.10 -c "import certifi; print(certifi.where())"

“command not found: brew”

Homebrew is not on PATH. For Apple Silicon, run:

eval "$(/opt/homebrew/bin/brew shellenv)"

Then add this line to ~/.zshrc.

pyenv: command not found after install

Shell config not reloaded. Run source ~/.zshrc or open a new terminal.

2.6.8. Next Steps