MacOS – Unable to brew install wine

command linehomebrewmacoswinexcode

Getting an error when trying to install wine using brew. Made sure I ran brew update and brew upgrade. Tried installing libpng on it's own as well, but still getting same error.

Just installed Xcode, and made sure I accepted the terms.

checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... ./install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking for gcc... clang
checking whether the C compiler works... no
configure: error: in `/private/tmp/libpng-20161205-66702-a4brfd/libpng-1.6.26':
configure: error: C compiler cannot create executables
See `config.log' for more details

Edit: Adding versions.

Mac OS X 10.11.6

Xcode: 8.1

Another edit: Looking through the gist of the error, I think this might be the culprit.

configure:3291: checking whether the C compiler works
configure:3313: clang    conftest.c  >&5
ld: unexpected token: !tapi-tbd-v2 file '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/lib/libSystem.tbd' for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
configure:3317: $? = 1
configure:3355: result: no
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "libpng"
| #define PACKAGE_TARNAME "libpng"
| #define PACKAGE_VERSION "1.6.26"
| #define PACKAGE_STRING "libpng 1.6.26"
| #define PACKAGE_BUGREPORT "png-mng-implement@lists.sourceforge.net"
| #define PACKAGE_URL ""
| #define PACKAGE "libpng"
| #define VERSION "1.6.26"
| /* end confdefs.h.  */
| 
| int
| main ()
| {
| 
|   ;
|   return 0;
| }
configure:3360: error: in `/private/tmp/libpng-20161205-66702-a4brfd/libpng-1.6.26':
configure:3362: error: C compiler cannot create executables
See `config.log' for more details

Edit: Adding gist logs.
https://gist.github.com/codephobia/98b8c8e5954c7d324384c49c6ebd99dc

Edit: I was able to get it working by cloning the repo and building it from the source code. I am going to leave this question open, since I would prefer to install it with brew to make updating easier.

Best Answer

Good work with the detailed error message. I would try to install just libpng with brew install libpng and then if that fails brew update && brew update && brew doctor just to check out common issues. ( I know you said you tried this - but it's not clear that you succeeded with that try)

The above recommendation is from https://github.com/Homebrew/brew/blob/master/docs/README.md#readme

That links to the Troubleshooting Checklist for if you find one package that fails you (looks like libpng from your logs so far).

run brew gist-logs <formula> (where <formula> is the name of the formula that fails you).