GCC versions pre-installed on OSX

I use GCC to build a dependency and when GCC is present on the OSX images, the Homebrew update and install steps can be removed, reducing job execution times.
But there is no documentation on which version is available on each image.

What I have found so far: (test set)

  • xcode11: gcc-9; g++-9
  • xcode10.2: gcc-8; g++-8
  • xcode10.1: gcc-8; g++-8
    execute: brew link gcc@8 to make GCC callable.
  • xcode10: …
  • xcode9: …
  • xcode8: gcc-4.9; g++-4.9
  • xcode7.3: gcc-4.9; g++-4.9
  • xcode6.4: gcc-4.9; g++-4.9

Does anyone have any additional information, or tips?

On the xcode10.1 (and later) GCC is installed as the latest release available on Homebrew. To ensure the GCC version is not changed with brew upgrade, I relink the installs from gcc to gcc@<version>:

- |
  # OSX: set Homebrew gcc to gcc@<version>, to prevent version upgrades
  if [[ "${TRAVIS_OSX_IMAGE:-}" && ${TRAVIS_OSX_IMAGE} =~ ^xcode(11|10\.[12])$ ]]; then
    brew unlink gcc
    if [[ ${TRAVIS_OSX_IMAGE} == "xcode11" ]]; then 
      brew link gcc@9
    else
      brew link gcc@8
    fi
  fi

This also covers the issue with xcode10.1 where GCC is not callable with g++-8.

Imprint