ci: fix several issues with preinstalled homebrew packages on Travis

Change-Id: Ibd0f5755f436dab119f6b6804973833d1e28ba7b
diff --git a/.travis.yml b/.travis.yml
index 0955d2a..412d7bc 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -58,7 +58,7 @@
       osx_image: xcode9.4
       env: OSX_VERSION=10.13
     - os: osx
-      osx_image: xcode10
+      osx_image: xcode10.1
       env: OSX_VERSION=10.13
 
   allow_failures:
@@ -89,6 +89,13 @@
 before_script:
   - if [[ ${TRAVIS_OS_NAME} == linux ]]; then export NODE_LABELS="Linux Ubuntu Ubuntu-16.04"; fi
   - if [[ ${TRAVIS_OS_NAME} == osx ]]; then export NODE_LABELS="OSX OSX-${OSX_VERSION}"; fi
+  - if [[ ${TRAVIS_OS_NAME} == osx ]]; then brew update; fi
+  # workaround for https://github.com/Homebrew/homebrew-core/issues/26358
+  - if [[ ${OSX_VERSION} == 10.12 ]]; then brew outdated python || brew upgrade python; fi
+  # workaround for https://github.com/travis-ci/travis-ci/issues/6688
+  - if [[ ${OSX_VERSION} == 10.12 ]]; then /usr/bin/yes | pip2 uninstall numpy || true; fi
+  # workaround for https://github.com/travis-ci/travis-ci/issues/8826
+  - if [[ ${TRAVIS_OS_NAME} == osx ]]; then brew cask uninstall --force oclint || true; fi
   - if [[ -n ${COMPILER} ]]; then export CXX=${COMPILER}; fi
   - ${CXX:-c++} --version
   - python --version