Install TensorFlow with CUDA 8.0 + cuDNN 5.1 support on macOS. All instructions are based on TensorFlow Get Started.

Install CUDA and cuDNN

You also need to add this line to your shell config.

export CUDA_HOME=/usr/local/cuda
export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:$CUDA_HOME/lib"
export PATH="$CUDA_HOME/bin:$PATH"

and build deviceQuery as test your environment.

cd /usr/local/cuda/samples/
make -C 1_Utilities/deviceQuery
./bin/x86_64/darwin/release/deviceQuery

Install TensorFlow

Install from pip

Build from source