"This UPX compressed binary contains an invalid Mach-O header and cannot be loaded."

Solution 1:

Revised answer:

For hiding traces, pirates zeroed the UPX markers out of the compressed binary, so it's not possible for macOS Sierra to decompress the binary. (Try with: hexdump -C YourApp.app/Contents/MacOS/YourApp | grep -C 1 UPX and see, that there is most likely no output.)

However, jreiser from UPX accepted the challenge and addressed this issue with implementing a more robust search for compressed code. v3.92 will be possible to make these apps running again when decompressing the executables with upx -d YourApp.app/Contents/MacOS/YourApp.

Solution 2:

3.92-BETA revision 3 works in Sierra and works for i386!

https://www.dropbox.com/s/x765t3i42p7hr8b/upx.out?dl=0 now works for I386, too.

jreiser on github.com/upx #4 comment

3.92 supports compressing binaries in Sierra such that they can be run in Sierra, and also supports decompressing binaries in Sierra. 3.92-BETA also supports decompressing binaries which have been modified after compression such as with a code signature.

Decompressing the app's binary using the -d option works great!

$ chmod +x upx.out 
$ ./upx.out -d /tmp/Run.app/Contents/MacOS/Run
                       Ultimate Packer for eXecutables
                          Copyright (C) 1996 - 2016
UPX 3.92-BETA   Markus Oberhumer, Laszlo Molnar & John Reiser   Sep 22nd 2016

        File size         Ratio      Format      Name
   --------------------   ------   -----------   -----------
     57444 <-     24576   42.78%   macho/i386    Run

Unpacked 1 file.

Solution 3:

brew install upx

upx -d YourApp.app/Contents/MacOS/YourApp

worked for me.

Solution 4:

I don't recognise your code in particular although this is a common issue with a new OS release (legacy software compatibility).

  • First step, look at the developers website for an indication they will be patching for Sierra. They may have posted a beta patch already that's not available through Software Update.

  • Send the Dev an email asking them directly. It can take them a while to catch-up particularly if they have multiple applications on multiple platforms.

  • Consider having a dual boot Mac. I generally keep a clone of my current system on another drive (or partition) after a new OS installation, then I can quickly re-boot and continue to use the software. I actually keep a legacy Mac these days running 10.6 and 10.8 just for this support.

  • Consider a virtual machine. You can use an emulator on OSX and install the OS version you prefer (including Windows). Not sure if emulators are released for Sierra yet though.