# \`brew upgrade\` fails on xcode9.4 due to swiftlint

**URL:** <https://travis-ci.community/t/brew-upgrade-fails-on-xcode9-4-due-to-swiftlint/6729>\
**Category:** macOS\
**Created:** [January 5, 2020, 4:28am UTC](https://travis-ci.community/t/brew-upgrade-fails-on-xcode9-4-due-to-swiftlint/6729 "2020-01-05T04:28:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![cartr](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/cartr/32/3561_2.png) [@cartr](https://travis-ci.community/u/cartr)\
**Post date:** [January 5, 2020, 4:28am UTC](https://travis-ci.community/t/brew-upgrade-fails-on-xcode9-4-due-to-swiftlint/6729/1 "2020-01-05T04:28:55Z")

</div>

I’m trying to use Travis to build a Homebrew bottle. As part of that process, I [run `brew upgrade && brew upgrade` on the build machine](https://github.com/cartr/qt4-autobottler/blob/a33de9dd2ace2ce4cc3d234aceaa092fe8180605/.travis.yml#L12-L14). However, this currently appears to [fail](https://travis-ci.org/cartr/qt4-autobottler/jobs/632835582) on `xcode9.4` with this error message:

```nohighlight
$ brew upgrade
==> Upgrading 15 outdated packages:
[...snip...]
swiftlint 0.28.2 -> 0.38.1
[...snip...]
swiftlint: A full installation of Xcode.app 10.2 is required to compile
this software. Installing just the Command Line Tools is not sufficient.

Xcode 10.2 cannot be installed on macOS 10.13.
You must upgrade your version of macOS.
Error: swiftlint: An unsatisfied requirement failed this build.

```

I could try and fix this by `brew uninstall`-ing some of the preinstalled packages before updating, but that seems like a hacky/brittle way to solve this problem. Does anyone know of a better way to ensure `brew upgrade` works in CI?

---

<div class="post-metadata">

**Author:** ![native-api](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/native-api/32/430_2.png) [@native-api](https://travis-ci.community/u/native-api)\
**Post date:** [January 5, 2020, 7:30am UTC](https://travis-ci.community/t/brew-upgrade-fails-on-xcode9-4-due-to-swiftlint/6729/2 "2020-01-05T07:30:28Z")

</div>

This is a problem with the `swiftlint` Homebrew package. [Homebrew requirements](https://docs.brew.sh/Installation#macos-requirements) list 10.13 as still supported and since “`Xcode 10.2 cannot be installed on macOS 10.13`”, formulae cannot hard-require it yet. Check [https://docs.brew.sh/Troubleshooting](https://docs.brew.sh/Troubleshooting) on further actions.

* * *

As a workaround, consider not running a full `brew upgrade` but rather only installing/upgrading the packages that you need. This will also save on build time, and upgrading packages that you don’t need is a waste anyway because the results will be lost when the build finishes.

---

<div class="post-metadata">

**Author:** ![cartr](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/cartr/32/3561_2.png) [@cartr](https://travis-ci.community/u/cartr)\
**Post date:** [January 5, 2020, 8:43am UTC](https://travis-ci.community/t/brew-upgrade-fails-on-xcode9-4-due-to-swiftlint/6729/3 "2020-01-05T08:43:07Z")

</div>

For posterity, I ended up running `brew remove swiftlint` before `brew update` in my CI script. (I didn’t want to try and only upgrade the packages I needed because I don’t know offhand what my full dependency tree is and wasn’t sure `brew install --only-dependencies` would do the right thing.)

I also ended up needing to `brew remove python@2` because it looks like Homebrew did another one of their upgrade-path-breaking package name shuffles (`python` -\> `python2`, `python3` -\> `python`). That’s Homebrew for ya: the only constant is constant breaking changes.
