Installing TensorFlow 1.2 / 1.3 from source with GPU support on macOS
Mattias Arro

Thanks for your post. It helps to build from source tensorflow r1.3.

The GPU version works great on iMac27 2017 with 1080Ti in Akitio Node.

Here is ‘build history’:

$ tar xvzf cudnn-8.0-osx-x64-v6.0.tgz
$ sudo cp -v -R cuda/* /usr/local/cuda/
$ brew install python3
$ brew switch bazel 0.5.2

$ python3 -m venv ~/venv/tf_gpu
$ source ~/venv/tf_gpu/bin/activate
$ pip3 install six numpy wheel
$ git clone
$ cd tensorflow/
$ git checkout r1.3
$ ./configure. #compute capability is here: 6.1 for 1080ti
$ bazel build — config=opt — config=cuda //tensorflow/tools/pip_package:build_pip_package
$ bazel-bin/tensorflow/tools/pip_package/build_pip_package ~/Code/Packages/tensorflow_pkg
$ pip3 install ~/Code/Packages/tensorflow_pkg/tensorflow-1.3.0-cp36-cp36m-macosx_10_12_x86_64.whl

And list of underwater stones :)

  1. “nvcc fatal : The version (‘80100’) of the host compiler (‘Apple clang’) is not supported”. Solution: Use the same version of XCODE as specified at
  2. /usl/local/cuda/libcuda.dylib not found Solution: Don’t uncheck anything in Cuda installer:) Leave options as default, including Cuda Driver
  3. dyld: Library not loaded: @rpath/libcudart.8.0.dylib 
    export CUDA_HOME=/usr/local/cuda
    export DYLD_LIBRARY_PATH=/usr/local/cuda/lib:/usr/local/cuda/extras/CUPTI/lib
  4. ld: library not found for -lgomp
    is in your post. Thanks again!
    diff — git a/third_party/gpus/cuda/BUILD.tpl b/third_party/gpus/cuda/BUILD.tpl
    index f7610dd..102026b 100644
     — — a/third_party/gpus/cuda/BUILD.tpl
    +++ b/third_party/gpus/cuda/BUILD.tpl
    @@ -95,7 +95,6 @@ cc_library(
    data = [“lib/%{cusolver_lib}”],
    includes = [“include”],
    linkstatic = 1,
    - linkopts = [“-lgomp”],
    visibility = [“//visibility:public”],

Which version of …?
macOS: 10.12.6
NVIDIA Web Driver: 378.05.05.25f01 installed by v1.0.1 from
CUDA Driver Version: 8.0.90 (Cuda installer + Cuda patch)
CudaNN: 6
XCode: $ gcc -v
Configured with: — prefix=/Library/Developer/CommandLineTools/usr — with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 8.0.0 (clang-800.0.42.1)

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.