Run these commands step by step in the terminal.

1. Get XCODE

xcode-select --install

2. Install homebrew

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

3. Install Python

brew install python

4. Setup the Virtual Environment

python3 -m venv ~/venv-metal
source ~/venv-metal/bin/activate
python -m pip install -U pip

5. Install Tensorflow

python -m pip install tensorflow
python -m pip install tensorflow-metal

6. Run this in the terminal

python3 -c "import tensorflow as tf; print(tf.reduce_sum(tf.random.normal([1000, 1000])))"

I found this last step to be crucial as it sets a few environmental settings.