Tmxrasterizer cannot run on macOS

macOS High Sierra 10.13.2. Tiled 1.1.4.

/Applications/Tiled.app/Contents/MacOS/tmxrasterizer
dyld: Library not loaded: /usr/local/opt/qt/lib/QtCore.framework/Versions/5/QtCore
  Referenced from: /Applications/Tiled.app/Contents/MacOS/tmxrasterizer
  Reason: image not found
Abort trap: 6

It seems to be looking for QtCore somewhere in /usr/local for some reason, instead of inside Tiled.app.

Alright, no problem. I will just copy those libraries and put them in that path. I copied all the Frameworks and put them in /usr/local/opt/qt/lib.

Now this is what it says:

/Applications/Tiled.app/Contents/MacOS/tmxrasterizer
objc[1352]: Class QMacAutoReleasePoolTracker is implemented in both /Applications/Tiled.app/Contents/Frameworks/QtCore.framework/Versions/5/QtCore (0x10bc7b2c8) and /usr/local/opt/qt/lib/QtCore.framework/Versions/5/QtCore (0x10b1232c8). One of the two will be used. Which one is undefined.
objc[1352]: Class QT_ROOT_LEVEL_POOL__THESE_OBJECTS_WILL_BE_RELEASED_WHEN_QAPP_GOES_OUT_OF_SCOPE is implemented in both /Applications/Tiled.app/Contents/Frameworks/QtCore.framework/Versions/5/QtCore (0x10bc7b340) and /usr/local/opt/qt/lib/QtCore.framework/Versions/5/QtCore (0x10b123340). One of the two will be used. Which one is undefined.
objc[1352]: Class RunLoopModeTracker is implemented in both /Applications/Tiled.app/Contents/Frameworks/QtCore.framework/Versions/5/QtCore (0x10bc7b368) and /usr/local/opt/qt/lib/QtCore.framework/Versions/5/QtCore (0x10b123368). One of the two will be used. Which one is undefined.
This application failed to start because it could not find or load the Qt platform plugin "cocoa"
in "".

Available platform plugins are: cocoa.

Reinstalling the application may fix this problem.
Abort trap: 6

So this is rather unnerving. Sure, it found the libraries, but THEN it also found the ones inside Tiled.app which it couldn’t find before. And now they are colliding.

Googling a bit mentioned something about using install_name_tool to redirect the libraries in /usr/local to the ones in Tiled.app, but either it doesn’t work or I’m just too inexperienced with these matters.

Can someone help me with this?

Copying those libraries onto your system is definitely not the way this should be fixed, but I’m not sure what the proper way would be. The following script is already trying to resolve such issues with the Qt deployment tool, and manual usage of otool and install_name_tool, but apparently it’s not working anymore (assuming it worked before):

I’m not the expert on these things either unfortunately.

Whoops, since a few releases I’m no longer uses the script linked above, which explains why the install name of the libraries has remained incorrect for those binaries!

I’ve just made a new release, Tiled 1.1.6, to which I’ve applied an updated script that should address these issues:

The above change should also address the same issue in the development snapshots.