现在你必须执行以下操作才能通过brew安装cuda:
brew tap homebrew/cask-drivers
brew cask install nvidia-cuda
See https://github.com/caskroom/homebrew-cask/issues/38325 https://github.com/caskroom/homebrew-cask/issues/38325。
然后您还需要将以下内容添加到您的文件中~/.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 http://docs.nvidia.com/cuda/cuda-installation-guide-mac-os-x/index.html.
UPDATE:具有激活的 SIP(系统完整性保护)的较新版本的 Mac OS X 将阻止修改 DYLD_LIBRARY_PATH(请参阅https://groups.google.com/forum/#!topic/caffe-users/waugt62RQMU https://groups.google.com/forum/#!topic/caffe-users/waugt62RQMU)。您可以通过检查
source ~/.bash_profile
env | grep DYLD_LIBRARY_PATH
如果此命令的输出为空,SIP 处于活动状态,您可能需要按照以下所述停用它https://www.macworld.com/article/2986118/security/how-to-modify-system-integrity-protection-in-el-capitan.html https://www.macworld.com/article/2986118/security/how-to-modify-system-integrity-protection-in-el-capitan.html。执行此操作后,您应该看到
env | grep DYLD_LIBRARY_PATH
DYLD_LIBRARY_PATH=/Developer/NVIDIA/CUDA-9.0/lib