Support OS X on Travis
diff --git a/.travis.yml b/.travis.yml
index b8b2d34..25be153 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -11,6 +11,9 @@
     - LD_LIBRARY_PATH=/tmp/protobuf-${PROTOBUF_VERSION}/lib:/tmp/openssl-${OPENSSL_VERSION}/lib
 
 before_install:
+    # Work around https://github.com/travis-ci/travis-ci/issues/2317
+  - if \[ "$TRAVIS_OS_NAME" = linux \]; then jdk_switcher use oraclejdk8; fi
+  - if \[ "$TRAVIS_OS_NAME" = osx \]; then brew update; fi
   - buildscripts/make_dependencies.sh # build protoc into /tmp/protobuf-${PROTOBUF_VERSION}
   - mkdir -p $HOME/.gradle
   - echo "checkstyle.ignoreFailures=false" >> $HOME/.gradle/gradle.properties
@@ -19,17 +22,20 @@
   - test -z "$(git status --porcelain)" || (git status && echo Error Working directory is not clean. Forget to commit generated files? && false)
 
 after_success:
-  - ./gradlew :grpc-all:coveralls
-
-jdk:
-  - oraclejdk8
+  - if \[ "$TRAVIS_OS_NAME" = linux \]; then ./gradlew :grpc-all:coveralls; fi
 
 os:
   - linux
+  - osx
+
+# This image comes with jdk8
+osx_image: xcode7
 
 notifications:
   email: false
 
+# Caching does not work for public repositories with OS X:
+# https://github.com/travis-ci/travis-ci/issues/4011
 cache:
   directories:
     - /tmp/protobuf-${PROTOBUF_VERSION}
diff --git a/buildscripts/make_dependencies.sh b/buildscripts/make_dependencies.sh
index 90cc64e..e2c05c1 100755
--- a/buildscripts/make_dependencies.sh
+++ b/buildscripts/make_dependencies.sh
@@ -11,6 +11,7 @@
 # Can't check for presence of directory as cache auto-creates it.
 if [ -f ${INSTALL_DIR}/bin/protoc ]; then
   echo "Not building protobuf. Already built"
+# TODO(ejona): swap to `brew install --devel protobuf` once it is up-to-date
 else
   wget -O - https://github.com/google/protobuf/archive/v${PROTOBUF_VERSION}.tar.gz | tar xz -C $DOWNLOAD_DIR
   pushd $DOWNLOAD_DIR/protobuf-${PROTOBUF_VERSION}
@@ -26,6 +27,8 @@
 
 if [ -f ${INSTALL_DIR}/lib/libssl.so ]; then
   echo "Not building openssl. Already built"
+elif [ "$(uname)" = Darwin ]; then
+  brew install openssl
 else
   wget -O - https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz | tar xz -C $DOWNLOAD_DIR
   pushd $DOWNLOAD_DIR/openssl-${OPENSSL_VERSION}