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

**URL:** <https://discourse.julialang.org/t/help-making-gfortran-dependency-in-a-package-work-on-travis-ci-mac/3656>\
**Category:** Internals & Design\
**Created:** [May 11, 2017, 8:01pm UTC](https://discourse.julialang.org/t/help-making-gfortran-dependency-in-a-package-work-on-travis-ci-mac/3656 "2017-05-11T20:01:12Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![ScottPJones](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/scottpjones/32/146_2.png) [@ScottPJones](https://discourse.julialang.org/u/ScottPJones)\
**Post date:** [May 11, 2017, 8:01pm UTC](https://discourse.julialang.org/t/help-making-gfortran-dependency-in-a-package-work-on-travis-ci-mac/3656/1 "2017-05-11T20:01:12Z")

</div>

I’ve been trying to figure out why [https://github.com/JuliaDiffEq/DASKR.jl](https://github.com/JuliaDiffEq/DASKR.jl) 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:

```julia
addons:
  apt_packages:
    - 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!

---

<div class="post-metadata">

**Author:** ![dpo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dpo/32/3335_2.png) [@dpo](https://discourse.julialang.org/u/dpo)\
**Post date:** [May 11, 2017, 8:46pm UTC](https://discourse.julialang.org/t/help-making-gfortran-dependency-in-a-package-work-on-travis-ci-mac/3656/2 "2017-05-11T20:46:18Z")

</div>

`brew install gcc` used to work.

---

<div class="post-metadata">

**Author:** ![tkelman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tkelman/32/692_2.png) [@tkelman](https://discourse.julialang.org/u/tkelman)\
**Post date:** [May 11, 2017, 8:51pm UTC](https://discourse.julialang.org/t/help-making-gfortran-dependency-in-a-package-work-on-travis-ci-mac/3656/3 "2017-05-11T20:51:39Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dpo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dpo/32/3335_2.png) [@dpo](https://discourse.julialang.org/u/dpo)\
**Post date:** [May 11, 2017, 11:07pm UTC](https://discourse.julialang.org/t/help-making-gfortran-dependency-in-a-package-work-on-travis-ci-mac/3656/4 "2017-05-11T23:07:22Z")

</div>

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`.

---

<div class="post-metadata">

**Author:** ![ScottPJones](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/scottpjones/32/146_2.png) [@ScottPJones](https://discourse.julialang.org/u/ScottPJones)\
**Post date:** [May 11, 2017, 11:15pm UTC](https://discourse.julialang.org/t/help-making-gfortran-dependency-in-a-package-work-on-travis-ci-mac/3656/5 "2017-05-11T23:15:28Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dpo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dpo/32/3335_2.png) [@dpo](https://discourse.julialang.org/u/dpo)\
**Post date:** [May 11, 2017, 11:40pm UTC](https://discourse.julialang.org/t/help-making-gfortran-dependency-in-a-package-work-on-travis-ci-mac/3656/6 "2017-05-11T23:40:32Z")

</div>

Here’s an example: [https://github.com/JuliaSmoothOptimizers/PROPACK.jl/blob/master/.travis.yml#L25](https://github.com/JuliaSmoothOptimizers/PROPACK.jl/blob/master/.travis.yml#L25)

---

<div class="post-metadata">

**Author:** ![traktofon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/traktofon/32/591_2.png) [@traktofon](https://discourse.julialang.org/u/traktofon)\
**Post date:** [May 12, 2017, 1:22am UTC](https://discourse.julialang.org/t/help-making-gfortran-dependency-in-a-package-work-on-travis-ci-mac/3656/7 "2017-05-12T01:22:45Z")

</div>

Here’s another example: [https://github.com/traktofon/FortranFiles.jl/blob/master/.travis.yml#L26-L28](https://github.com/traktofon/FortranFiles.jl/blob/master/.travis.yml#L26-L28)

The difference to @dpo’s version is an additional call to `brew update` before the install, which is recommended by the [Travis CI documentation](https://docs.travis-ci.com/user/osx-ci-environment/#Homebrew).

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.

---

<div class="post-metadata">

**Author:** ![dpo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dpo/32/3335_2.png) [@dpo](https://discourse.julialang.org/u/dpo)\
**Post date:** [May 12, 2017, 2:34am UTC](https://discourse.julialang.org/t/help-making-gfortran-dependency-in-a-package-work-on-travis-ci-mac/3656/8 "2017-05-12T02:34:07Z")

</div>

There’s no need for `brew update` any more because `brew install` now automatically triggers an update: [Travis CI - Test and Deploy Your Code with Confidence](https://travis-ci.org/JuliaSmoothOptimizers/PROPACK.jl/jobs/231360902#L86)

---

<div class="post-metadata">

**Author:** ![ScottPJones](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/scottpjones/32/146_2.png) [@ScottPJones](https://discourse.julialang.org/u/ScottPJones)\
**Post date:** [May 12, 2017, 9:46am UTC](https://discourse.julialang.org/t/help-making-gfortran-dependency-in-a-package-work-on-travis-ci-mac/3656/9 "2017-05-12T09:46:58Z")

</div>

That did the trick! If anybody needs to use [https://github.com/JuliaDiffEq/DASKR.jl](https://github.com/JuliaDiffEq/DASKR.jl) on the Mac, it’s now working 😉  
Thanks everybody for the help!
