Zip file problem on Mac
neville.smythe at optusnet.com.au
Wed May 4 10:47:47 EDT 2022
I distribute a Mac standalone via a zip file, created using revZipOpenArchive etc.
This has worked fine until macOS Monterey or LiveCode 9.6.x
Either a bug has been introduced into the revZip tools in 9.6.x, or I have a corrupted version, or the Mac Archive Utility has changed so as to make the rev zip tool fail. Can anyone verify the following?
On my Mac, the Archive Utility in Monterey, which automagically unzips files when a zip file is downloaded by Safari or double-clicked, now unsets the execute bit on the application (more precisely, on the executable file in the bundle). Which means the user gets a “This application could not be opened”, with no options to continue, when they try to launch the unzipped app. A terminal savvy user can use chmod x+ to make the app launchable, but I can hardly expect the ordinary user to have to do that. The execute bit is definitely set in the archive, because TheUnarchiver, a free third party decompression tool, unzips the file leaving the app launchable. This also suggests that the problem is not in my code.
I can see why Granny Apple might have thought this was a good idea, executables in zip files are a the major sources of trojans, but if Apple has made this change it is a bit nasty because there is no obvious way to override the behaviour.
If I use the Archive Utility to actually create the zip file from the standalone app bundle rather than using the rev tools, and then double-click it to decompress, the file unzips with the execute bit set. This shows the archive produced by revZip is not the same as that expected by the Archive Utility. It also suggests a workaround would be to use Archive Utility from a shell command (it is not AppleScriptable – bad Apple!). From a cursory search on Stackoverflow, the command line would be (this is not yet tested and the post is 5 years old)
ditto -c -k --sequesterRsrc --keepParent Product.app Product.app.zip
to create the zip file for the Mac platform. The post says that is what the Archive Utility uses to compress files. Probably the rev zip tools use zlib. Or maybe I should be creating a .dmg disk image instead of a zip file.
More information about the use-livecode