# Travis Homebrew Failure

**URL:** <https://discourse.julialang.org/t/travis-homebrew-failure/6361>\
**Category:** General Usage\
**Tags:** travis\
**Created:** [October 9, 2017, 7:40pm UTC](https://discourse.julialang.org/t/travis-homebrew-failure/6361 "2017-10-09T19:40:53Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![cortner](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cortner/32/204_2.png) [@cortner](https://discourse.julialang.org/u/cortner)\
**Post date:** [October 9, 2017, 7:40pm UTC](https://discourse.julialang.org/t/travis-homebrew-failure/6361/1 "2017-10-09T19:40:53Z")

</div>

Recently I get the following error on travis:

```julia
/usr/local/Homebrew/Library/Homebrew/brew.rb:12:in `<main>': Homebrew must be run under Ruby 2.3! (RuntimeError)
The command "if [$TRAVIS_OS_NAME = osx]; then brew install gcc; fi" exited with 1.

```

I am not sure where to start fixing this and would be grateful for suggestions.

Here is my Travis file:

```julia
language: julia

os:
  - linux
  - osx

julia:
  - 0.5

addons:
  apt:
    packages:
    - gfortran

notifications:
  email: false

script:
  - if [$TRAVIS_OS_NAME = osx]; then brew install gcc; fi
  - if [[-a .git/shallow]]; then git fetch --unshallow; fi
  - julia -e 'ENV["PYTHON"]=""; Pkg.add("PyCall"); Pkg.add("Conda"); using Conda; Conda.add("NumPy"); Conda.add("SciPy"); Pkg.clone(pwd()); Pkg.build("JuLIP"); Pkg.test("JuLIP"; coverage=true)'

```

---

<div class="post-metadata">

**Author:** ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Post date:** [October 9, 2017, 8:26pm UTC](https://discourse.julialang.org/t/travis-homebrew-failure/6361/2 "2017-10-09T20:26:45Z")

</div>

I got that too

---

<div class="post-metadata">

**Author:** ![cortner](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cortner/32/204_2.png) [@cortner](https://discourse.julialang.org/u/cortner)\
**Post date:** [October 10, 2017, 8:20am UTC](https://discourse.julialang.org/t/travis-homebrew-failure/6361/3 "2017-10-10T08:20:38Z")

</div>

It seems, this is the problem:  
[https://github.com/travis-ci/travis-ci/issues/8552](https://github.com/travis-ci/travis-ci/issues/8552)

---

<div class="post-metadata">

**Author:** ![cortner](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cortner/32/204_2.png) [@cortner](https://discourse.julialang.org/u/cortner)\
**Post date:** [October 10, 2017, 9:29am UTC](https://discourse.julialang.org/t/travis-homebrew-failure/6361/4 "2017-10-10T09:29:06Z")

</div>

```julia
before_install:
  - brew update

```

fixes the problem

---

<div class="post-metadata">

**Author:** ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Post date:** [October 10, 2017, 5:40pm UTC](https://discourse.julialang.org/t/travis-homebrew-failure/6361/5 "2017-10-10T17:40:45Z")

</div>

Hmmm, I have this in

```julia
  - if [`uname` = "Linux"]; then
      sudo apt-get install libgmt-dev;
    elif [`uname` = "Darwin"]; then
      brew update
      brew install homebrew/science/gmt;
    fi

```

but it now still errors

```julia
$ if [`uname` = "Linux"]; then sudo apt-get install libgmt-dev; elif [`uname` = "Darwin"]; then brew update brew install homebrew/science/gmt; fi

Error: This command updates brew itself, and does not take formula names.

Use 'brew upgrade <formula>'.

```

---

<div class="post-metadata">

**Author:** ![rdeits](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rdeits/32/286_2.png) [@rdeits](https://discourse.julialang.org/u/rdeits)\
**Post date:** [October 10, 2017, 6:52pm UTC](https://discourse.julialang.org/t/travis-homebrew-failure/6361/6 "2017-10-10T18:52:13Z")

</div>

Travis does not properly handle multi-line bash commands. You can either put everything in one line (with `&&` or `;` to separate commands) or just put all the steps into a shell script and call that script from `.travis.yml`.

---

<div class="post-metadata">

**Author:** ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Post date:** [October 11, 2017, 12:15am UTC](https://discourse.julialang.org/t/travis-homebrew-failure/6361/7 "2017-10-11T00:15:00Z")

</div>

Yes, with the && (`brew update && brew install ...`) it worked. Thanks.
