Help making gfortran dependency in a package work on Travis-CI (Mac)


I’ve been trying to figure out why doesn’t work on Travis-CI (for Mac).
It seems that the problem is that gfortran isn’t available.
The .travis.yml file has the following:

    - gfortran

that seems to make sure that gfortran is available for Linux builds, however that doesn’t work for Mac builds.

Any help would be appreciated!


brew install gcc used to work.


gcc 7 may have broken a number of things when it comes to fortran dependencies


It’s just not installed by default. Or did you mean something else? If gcc 7 is a problem, you can brew install gcc@6.


Thanks @tkelman & @dpo!
How would one do that in the Travis-CI .travis.yml file? (and do it only for OS X?)


Here’s an example:


Here’s another example:

The difference to @dpo’s version is an additional call to brew update before the install, which is recommended by the Travis CI documentation.

BTW, for my package, the brew calls take more time than the actual testing. If you encounter something similar, don’t try to speed those up by using Travis’ caching – I tried that, but retrieving the cache takes as long as the brew calls.


There’s no need for brew update any more because brew install now automatically triggers an update:


That did the trick! If anybody needs to use on the Mac, it’s now working :wink:
Thanks everybody for the help!