From e69d9f880677f2aa3488c80b953ec4309f0dfa2e Mon Sep 17 00:00:00 2001
From: costan <costan@google.com>
Date: Thu, 4 Jan 2018 14:26:40 -0800
Subject: [PATCH 03/35] Fix Travis CI configuration for OSX.

---
 .travis.yml | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 9841e9a..8816edb 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -38,10 +38,17 @@ addons:
     - clang-4.0
 
 install:
-# Travis doesn't have a nice way to install homebrew packages yet.
-# https://github.com/travis-ci/travis-ci/issues/5377
-- if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew update; fi
-- if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew install gcc@6; fi
+# Travis doesn't have a DSL for installing homebrew packages yet. Status tracked
+# in https://github.com/travis-ci/travis-ci/issues/5377
+# The Travis VM image for Mac already has a link at /usr/local/include/c++,
+# causing Homebrew's gcc@6 installation to error out. This was reported to
+# Homebrew maintainers at https://github.com/Homebrew/brew/issues/1742 and
+# removing the link emerged as a workaround.
+- if [ "$TRAVIS_OS_NAME" == "osx" ]; then
+    brew update;
+    if [ -L /usr/local/include/c++ ]; then rm /usr/local/include/c++; fi;
+    brew install gcc@6;
+  fi
 # /usr/bin/gcc is stuck to old versions by on both Linux and OSX.
 - if [ "$CXX" = "g++" ]; then export CXX="g++-6" CC="gcc-6"; fi
 - echo ${CC}
-- 
1.8.3.1

