Installing cuda via brew and dmg

Nowadays you have to do the following to install cuda via brew:

brew tap homebrew/cask-drivers
brew cask install nvidia-cuda

See https://github.com/caskroom/homebrew-cask/issues/38325 . Then you also need to add the following to your file ~/.bash_profile:

export PATH=/Developer/NVIDIA/CUDA-9.0/bin${PATH:+:${PATH}}
export DYLD_LIBRARY_PATH=/Developer/NVIDIA/CUDA-9.0/lib${DYLD_LIBRARY_PATH:+:${DYLD_LIBRARY_PATH}}

See http://docs.nvidia.com/cuda/cuda-installation-guide-mac-os-x/index.html.

UPDATE: Newer versions of Mac OS X with activated SIP (System integrity protection) will prevent modifying the DYLD_LIBRARY_PATH (see https://groups.google.com/forum/#!topic/caffe-users/waugt62RQMU). You can check that via

source ~/.bash_profile
env | grep DYLD_LIBRARY_PATH

If the output of this command is empty SIP is active and you might want to deactivate it as described at https://www.macworld.com/article/2986118/security/how-to-modify-system-integrity-protection-in-el-capitan.html . After doing this you should see

env | grep DYLD_LIBRARY_PATH
DYLD_LIBRARY_PATH=/Developer/NVIDIA/CUDA-9.0/lib

Both methods download and install from the same .dmg file from NVidia.

The homebrew-cask framework is the preferred method for installing software distributed as binaries in the homebrew paradigm.

This is my understanding.

Tags:

Cuda

Dmg

Gpu

Nvidia