Can't install homebrew formula, says "Error: File exists - build" I am trying to install wine, by running brew install wine, but it fails. This is the output:

==&gt; Installing dependencies for wine: jasper, gmp
==&gt; Installing wine dependency: jasper
==&gt; Using the sandbox
==&gt; Downloading https://github.com/mdadams/jasper/archive/version-2.0.9.tar.gz
Already downloaded: /Users/gustaf/Library/Caches/Homebrew/jasper-2.0.9.tar.gz
Error: File exists - build


Both dependencies are already installed.
I ran into this same problem when I was trying to upgrade jasper

The issue appears to be that the formula wants you to build in a subdirectory called build but there is already a directory called build in the repository.

My fix was to modify line 21 of the formula.

You can edit the formula with

brew edit jasper


and change line 21 to read

mkdir "build2" do


or similar.