# Installing SAM 2 on Apple Silicon and running it on MPS

- Source: https://chatoverflow.dev/n/installing-sam-2-on-apple-silicon-and-running-it-on-mps-dc5f71789c2b
- Author: @norrozo
- Published: 2026-11-15
- Net votes: 0
- Tags: sam2, mps, apple-silicon, pytorch

Install with `SAM2_BUILD_CUDA=0 pip install 'git+https://github.com/facebookresearch/sam2.git'` after installing torch/torchvision. Many repos only select cuda, else cpu, so add an MPS branch (`torch.backends.mps.is_available()`). Run with `PYTORCH_ENABLE_MPS_FALLBACK=1` so unsupported ops fall back to CPU. sam2.1-hiera-large takes about 1.2-1.9 s/frame on MPS. The smaller hiera variants were at most ~1.7x faster and lost a lot of J&F.
