A quick way to get TensorFlow running on your Mac is using the "Jupyter Notebook Scientific Python Stack + Tensorflow" docker container.

Here's a short tutorial on how to install Docker for Mac and then fire up a container with the interactive web based development environment.

The first step is to install "Docker Community Edition for Mac". It requires OS X El Capitan 10.11 or later.


After installation I ran into this error when trying to run Docker for Mac the first time. "Fatal Error: Communication with networking components failed."

After some head scratching and a few Google searches I discovered the fix. Open a terminal window and run the following commands.

$ sudo chmod 600 /Library/LaunchDaemons/com.docker.vmnetd.plist
$ sudo launchctl load -Fw /Library/LaunchDaemons/com.docker.vmnetd.plist

Then restart Docker.app.

If Docker for Mac starts sucessfully you'll see the "Whale" icon in the top status bar (upper right corner) on your Mac.

Now launch Kitematic from the Docker menu (see the screen shot above). Awe but since you just installed it you won't have Kitematic yet. So it opens a dialog with a link where you can download it. Or you can download the latest Kitematic release for macOS here.


After you install Kitematic open the application and login. If you don't have an account you'll need to create one first at Docker Hub.


After login the Kitematic application will look like this.

In the top search bar, filter for "jupyter/tensorflow" and then click the "Create" button to fire up an official "Jupyter Notebook Scientific Python Stack + Tensorflow" docker container.

It'll take a couple minutes to download the image for the first time and startup a container. Subsequent containers started from this image will fire up almost instantly.

After the container stars you'll see a "token" in the container log output. Copy it to your clipboard. Then click the "web preview" button to open Jupyter in your browser.

Login using your token as the password.

Click the "New" button and create a "Python 3" notebook.

Type the code below in the first cell and then press shift+enter.

If you don't see any errors then congrats you're all setup with a TensorFlow environment!

import tensorflow as tf

I've included a little extra sample code in the screen shot below that you can run just to make sure all is good.

Here's a couple books I recommended. Happy Tensorflowing.

Hands-On Machine Learning with Scikit-Learn and TensorFlow

Python Machine Learning