From a2497e0854a1672e513ed518752797f9231b6a12 Mon Sep 17 00:00:00 2001 From: Job Evers-Meltzer Date: Mon, 19 Dec 2016 15:28:20 -0800 Subject: [PATCH] Fix error on brew when package is already installed --- packaging/travis/setup_osx.sh | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/packaging/travis/setup_osx.sh b/packaging/travis/setup_osx.sh index 503882675..f4a5eb659 100755 --- a/packaging/travis/setup_osx.sh +++ b/packaging/travis/setup_osx.sh @@ -7,5 +7,19 @@ wget https://www.python.org/ftp/python/2.7.11/python-2.7.11-macosx10.6.pkg sudo installer -pkg python-2.7.11-macosx10.6.pkg -target / pip install -U pip brew update -brew install openssl -brew link --force openssl + +# follow this pattern to avoid failing if its already +# installed by brew: +# http://stackoverflow.com/a/20802425 +if brew ls --versions gmp > /dev/null; then + echo 'gmp is already installed by brew' +else + brew install gmp +fi + +if brew ls --versions openssl > /dev/null; then + echo 'openssl is already installed by brew' +else + brew install openssl + brew link --force openssl +fi