Search code examples
homebrewmacos-high-sierrahomebrew-cask

brew cask install meld: 'cannot import GTK+': what's wrong with my library?


I tried to install meld on my iMac running OS/X 10.13.1 High Sierra.

brew cask install meld

and homebrew completed without error, but when I tried to run it I saw

$ meld check1ping.sh check2pings.sh
frozen: ImportError
Cannot import: GTK+
dlopen(/Applications/Meld.app/Contents/Resources/lib/python2.7/gi/_gi.so, 2): Symbol not found: _inflateValidate
  Referenced from: /System/Library/Frameworks/ImageIO.framework/Versions/A/Resources/libPng.dylib
  Expected in: /Applications/Meld.app/Contents/Frameworks/libz.1.dylib
 in /System/Library/Frameworks/ImageIO.framework/Versions/A/Resources/libPng.dylib

I note the questions How do I fix melds 'Cannot import: GTK+' error caused by missing 'gi.repository'? and Meld error "Cannot import: GTK+; No module named repository" but this problem seems to be different.

I found this page which suggests that /Applications/Meld.app/Contents/Frameworks/libz.1.dylib is out of date. This is what I saw in /Applications/Meld.app/Contents/Frameworks:

-rwxr-xr-x  1 myusername  staff   127692  4 May  2016 libz.1.2.8.dylib
lrwxr-xr-x  1 myusername  staff       16 16 Nov 15:24 libz.1.dylib -> libz.1.2.8.dylib

Looking for a replacement, I found:

lrwxr-xr-x  1 root  wheel      12 11 Nov 09:57 /usr/lib/libz.1.1.3.dylib -> libz.1.dylib
lrwxr-xr-x  1 root  wheel      12 11 Nov 09:57 /usr/lib/libz.1.2.11.dylib -> libz.1.dylib
lrwxr-xr-x  1 root  wheel      12 11 Nov 09:57 /usr/lib/libz.1.2.5.dylib -> libz.1.dylib
lrwxr-xr-x  1 root  wheel      12 11 Nov 09:57 /usr/lib/libz.1.2.8.dylib -> libz.1.dylib
-rwxr-xr-x  1 root  wheel  186432 25 Oct 17:37 /usr/lib/libz.1.dylib
lrwxr-xr-x  1 root  wheel      12 11 Nov 09:57 /usr/lib/libz.dylib -> libz.1.dylib

and when I replaced the libz.1.dylib in my meld app with this one, everything magically worked.

My question is: how do I fix homebrew so that it picks up the correct version of the library, so future users don't have this problem?

I see that brew cask cannot build from source and always installs from a binary, so I'm a bit surprised that it seems to have the wrong library version. I found the meld ruby file but am none the wiser. I know nothing about specifying brew or cask builds, I'm afraid.

Thanks!


Solution

  • This is now fixed upstream. All you need to do is to update the Meld cask.

    Updating is a bit counterintuitive. To update the list of available casks you use brew update, not brew cask update, but to upgrade casks to the new version you use brew cask upgrade, not just brew upgrade.

    So the correct sequence to update all installed casks is:

    brew update
    brew cask upgrade