Fix for macOS Sonoma

All flavors welcome.
Forum rules
Be kind.
Tom
Posts: 5
Joined: Fri Oct 20, 2023 7:43 am
Contact:

Fix for macOS Sonoma

Post by Tom »

I have modified the latest available community version of LiveCode to run smoothly on macOS Sonoma. Since I am probably not allowed to publish it unchanged (with the LiveCode trademark included), here is how you can patch it yourself.

(For those who can afford it, I think it would still be a good idea to buy a licence from LiveCode to support further development. That way you also get an Apple Silicon native version of the program.)

I applied the patch directly to the machine code of the original application and did not bother to download and recompile the source code. If anyone wants to fix the bug in the source code, just drop me a line. I guess it should not be too difficult to find the corresponding places in the source code.
  1. Download LiveCode Community 9.6.3 and install it by copying it to your Applications folder.
  2. Open LiveCode from the Applications folder once to get Gatekeeper out of the way.
  3. Quit LiveCode again (on Sonoma, it will crash automatically for you :twisted:)
  4. Download the attached zip file and unpack it.
  5. Put patch1.hex and patch2.hex on your desktop. One contains the fixes for the IDE itself, the other one ensures that the standalones you create work correctly.
  6. Open a terminal.
  7. Copy and paste the following command into your terminal and press the Return key:

    Code: Select all

    sudo xxd -r ~/Desktop/patch1.hex /Applications/LiveCode\ Community\ 9.6.3.app/Contents/MacOS/LiveCode-Community
    You will have to enter your password (nothing will be displayed on the screen) and press Return again.
  8. Now copy and paste the command for the second patch into your terminal and press the Return key:

    Code: Select all

    sudo xxd -r ~/Desktop/patch2.hex /Applications/LiveCode\ Community\ 9.6.3.app/Contents/Tools/Runtime/Mac\ OS\ X/x86-64/Standalone.app/Contents/MacOS/Standalone-Community
  9. Now LiveCode is fixed (you can now delete the patch files), but it will not work because macOS will eventually notice that it has been modified. So we need to re-sign the modified application. Run these two commands in your terminal. Copy and paste one command at a time and press Return after each command:

    Code: Select all

    sudo codesign -f -s- --deep /Applications/LiveCode\ Community\ 9.6.3.app/Contents/Tools/Runtime/Mac\ OS\ X/x86-64/Standalone.app
    If you don't have the necessary developer tools on your Mac, macOS should ask you at this point if you want to download them. Just click "Install". Wait until the installation has completed (this can take quite some time), then don't forget to run the above codesign command again before entering the second one.

    Code: Select all

    sudo codesign -f -s- --deep /Applications/LiveCode\ Community\ 9.6.3.app
  10. That's it! You're ready to go again. 8-)
Attachments
patch.zip
(710 Bytes) Downloaded 288 times
User avatar
richmond62
Posts: 3896
Joined: Sun Sep 12, 2021 11:03 am
Location: Bulgaria
Contact:

Re: Fix for macOS Sonoma

Post by richmond62 »

Wow!

Will try that this evening on my machine running MacOS 14.

And, where did you suddenly appear from as the bearer of wonderful gifts? 8-)
https://richmondmathewson.owlstown.net/
User avatar
tperry2x
Posts: 2475
Joined: Tue Dec 21, 2021 9:10 pm
Location: Somewhere in deepest darkest Norfolk, England
Contact:

Re: Fix for macOS Sonoma

Post by tperry2x »

Tom, thank you so much for this.
I feel like a million thank you's won't go far enough.

I've just successfully applied this as per your instructions, to OpenXTalk Lite 0.92 on the mac. I will upload this at some point very soon and post a link. If some brave soul wants to try it out on Sonoma?
User avatar
richmond62
Posts: 3896
Joined: Sun Sep 12, 2021 11:03 am
Location: Bulgaria
Contact:

Re: Fix for macOS Sonoma

Post by richmond62 »

Tom, thank you so much for this.
I feel like a million thank you's won't go far enough.
Indeed: you have really dug us out of a seriously sticky patch. 8-)
https://richmondmathewson.owlstown.net/
FourthWorld
Posts: 379
Joined: Sat Sep 11, 2021 4:37 pm
Contact:

Re: Fix for macOS Sonoma

Post by FourthWorld »

Tom wrote: Fri Oct 20, 2023 8:35 am I applied the patch directly to the machine code of the original application and did not bother to download and recompile the source code. If anyone wants to fix the bug in the source code, just drop me a line. I guess it should not be too difficult to find the corresponding places in the source code.
Thank you for this contribution. Very valuable, and much appreciated.

Can you describe what was changed? It would be helpful in itself to understand what we're applying, and of course given how unusual it is to make machine code patches I'm guessing most here would need to review the change in detail before sharing any engine modified with a binary patch from a stranger on the internet.

Also, have you passed this to the LC team? It may be helpful there as well.
User avatar
richmond62
Posts: 3896
Joined: Sun Sep 12, 2021 11:03 am
Location: Bulgaria
Contact:

Re: Fix for macOS Sonoma

Post by richmond62 »

Also, have you passed this to the LC team? It may be helpful there as well.
I would not do that as they are trying to keep their paws clean and away from the likes of us.
https://richmondmathewson.owlstown.net/
FourthWorld
Posts: 379
Joined: Sat Sep 11, 2021 4:37 pm
Contact:

Re: Fix for macOS Sonoma

Post by FourthWorld »

richmond62 wrote: Fri Oct 20, 2023 4:08 pm
Also, have you passed this to the LC team? It may be helpful there as well.
I would not do that as they are trying to keep their paws clean and away from the likes of us.
The author of code determines its use. If inclined, Tom could deliver code to them under license compatible with their needs, independent of any arrangements made with others.

Without source, I'm not sure how this contribution can be understood as governed by GPLv3, but I trust that can be sorted when this becomes a normal pull request.
User avatar
richmond62
Posts: 3896
Joined: Sun Sep 12, 2021 11:03 am
Location: Bulgaria
Contact:

Re: Fix for macOS Sonoma

Post by richmond62 »

As 'Tom' has, apparently appeared "5 minutes ago" I am going to treat his suggestion with extreme caution, starting with a Time Machine back of my Mac Mini before I do anything whatsoever.

There is a school of thought that 'Tom' may be someone we know and love from of old, but for various reasons has decided to masquerade as a newcomer . . .
https://richmondmathewson.owlstown.net/
User avatar
tperry2x
Posts: 2475
Joined: Tue Dec 21, 2021 9:10 pm
Location: Somewhere in deepest darkest Norfolk, England
Contact:

Re: Fix for macOS Sonoma

Post by tperry2x »

Initial findings on patched version:

Under OSX 10.9, seems to run fine.

Under MacOs 10.15 Catalina, I'm getting:
Image

And have to run:
sudo spctl --master-disable

Which allows it to be opened from unidentified developers.
Tom
Posts: 5
Joined: Fri Oct 20, 2023 7:43 am
Contact:

Re: Fix for macOS Sonoma

Post by Tom »

Oh wow, I was just checking to see if anyone had already downloaded the patch, and there's a lot going on here!
richmond62 wrote: Fri Oct 20, 2023 8:51 am And, where did you suddenly appear from as the bearer of wonderful gifts? 8-)
:D
That is easy to answer: a friend asked me to teach her a bit of programming, and I thought LiveCode would be good for that. (I've never developed something using LiveCode myself, but I used to use HyperCard and SuperCard.) It was only then that I discovered that LiveCode was no longer available as a community version, and when I found the last version somewhere it did not run at all. Looking for a solution, I found this forum and learned that there was no solution yet. That's why I wrote the patch yesterday.
FourthWorld wrote: Fri Oct 20, 2023 2:49 pm Can you describe what was changed? It would be helpful in itself to understand what we're applying, and of course given how unusual it is to make machine code patches I'm guessing most here would need to review the change in detail before sharing any engine modified with a binary patch from a stranger on the internet.
Sure, it's actually quite simple: Sonoma inserts the new "AutoFill" menu into the Edit menu, and LiveCode doesn't expect this suprise menu and stumbles over it. So I added a check to skip this menu and avoid the crash. I also fixed a bug that caused windows to suddenly hide in the background sometimes when the backdrop was turned on. I don't know if this was already the case in Ventura, or if it's another new bug with Sonoma.

Can you trust the code if I am a complete stranger here? You can never be too careful, but if you look at how much the patched program differs from the unpatched one, you will see that only 52 bytes have been changed (before the signing). It would be quite impressive if someone could inject serious malicious code in 52 bytes and still fix the two bugs at the same time. So I would say you can trust me. 8-)
tperry2x wrote: Fri Oct 20, 2023 6:19 pm Under MacOs 10.15 Catalina, I'm getting:
Image
The ad hoc signature won't work if the app is copied over the network to another Mac. You could try to remove the signature completely instead of adding an ad hoc signature before you package the app by running

Code: Select all

codesign --remove-signature /path/to/OpenXTalk.app
You should then be able to open the app without the spctl stuff by ctrl-clicking and choosing Open. Of course, to completely remove the Gatekeeper warning, you would need to register as a developer with Apple and properly sign and notarise the app.
By the way, I have no idea if the patch will work with OpenXTalk as is, as I've only tested it with LiveCode 9.6.3, but if the app still works after applying the patch, that's probably a good sign. :shock:
User avatar
tperry2x
Posts: 2475
Joined: Tue Dec 21, 2021 9:10 pm
Location: Somewhere in deepest darkest Norfolk, England
Contact:

Re: Fix for macOS Sonoma

Post by tperry2x »

Thank you Tom.
Yes, seems to work absolutely fine and builds 64bit Mac standalones without any complaints.
I will try your suggestions, but codesigning continues to be a headache, however I think Paul is looking into a developer certificate for OpenXTalk.

Your patch seems to work fine in OpenXtalk lite as that is based on 9.6.3 community and the binaries themselves aren't modified, just the supporting stacks and resources over time, so I thought it would run exactly the same.

I can't test on Sonoma myself. My Mac is too old / not powerful enough. However I may be able to borrow someone's Sonoma Mac, if I ask nicely, for testing next week.
FourthWorld
Posts: 379
Joined: Sat Sep 11, 2021 4:37 pm
Contact:

Re: Fix for macOS Sonoma

Post by FourthWorld »

I appreciate the background info, Tom. Thank you for taking the time to provide that.
User avatar
richmond62
Posts: 3896
Joined: Sun Sep 12, 2021 11:03 am
Location: Bulgaria
Contact:

Re: Fix for macOS Sonoma

Post by richmond62 »

I am going to attempt to patch LC Community 8.1.10 & 9.6.3 on my iMac MacOS 12 and then transfer them via a USB drive to my Mac Mini MacOS 14:

whether that will work has yet to be seen.

Portativity in one way or another would prove extremely useful. I wonder if patched things 'cannot' go funny being transferred over a network (presumably in a .7z, .zip, or other compressed format), if they cannot be transferred in a DMG disk image?

If that does NOT work I will try the patching directly on the MacOS 14 machine.

[The main reason I am doing this is because the iMac 27" has 2 big, additional monitors attached to it, while the Mac Mini has a very modest single monitor to it and real estate is at a premium.]
https://richmondmathewson.owlstown.net/
User avatar
richmond62
Posts: 3896
Joined: Sun Sep 12, 2021 11:03 am
Location: Bulgaria
Contact:

Re: Fix for macOS Sonoma

Post by richmond62 »

OK: all done [mind you I wonder about 8.1.10], and it's time for a walk across the room:
-
Screenshot 2023-10-21 at 12.16.30.png
Screenshot 2023-10-21 at 12.16.30.png (620.99 KiB) Viewed 9383 times
-
Hot Damn: seems very slow to copy files [on my Linux boxes it seems about 5 times faster]:
-
Screenshot 2023-10-21 at 12.24.10.png
Screenshot 2023-10-21 at 12.24.10.png (31.82 KiB) Viewed 9382 times
-
And, presumably, things will take just as long on the otherside of the room . . . coffee time, obviously. 8-)

Ah: interestingly, NOT:
-
SShot 2023-10-21 at 12.32.52.png
SShot 2023-10-21 at 12.32.52.png (31.3 KiB) Viewed 9376 times
https://richmondmathewson.owlstown.net/
User avatar
richmond62
Posts: 3896
Joined: Sun Sep 12, 2021 11:03 am
Location: Bulgaria
Contact:

Re: Fix for macOS Sonoma

Post by richmond62 »

GREAT JOY!

LC 963 runs

LC 8.1.10 does not (but I am not surprised).

Bless you Tom, and forgive me that I doubted you. 8-)

Obviously the next question to ask is how you worked that out.

AND further to this it is worth noting that

"The ad hoc signature" worked perfectly alright when the app was transferred via a USB flash drive.

OF COURSE, the next exercise is to see if this sort of thing works with OXT & OXT Lite.

I shall also have a go with LC 961 for the sake of 32-bit standalones.

The patched version of LC 963 also works without any obvious problems on MacOS 12: so this should be fine to
use on pre-MacOS 14 versions to author standalones to run on MacOS 14: which is extremely valuable.
-
Screenshot 2023-10-21 at 12.57.13.png
Screenshot 2023-10-21 at 12.57.13.png (200.95 KiB) Viewed 9371 times
https://richmondmathewson.owlstown.net/
User avatar
richmond62
Posts: 3896
Joined: Sun Sep 12, 2021 11:03 am
Location: Bulgaria
Contact:

Re: Fix for macOS Sonoma

Post by richmond62 »

Since I am probably not allowed to publish it unchanged (with the LiveCode trademark included)
There is an interesting question, as, surely, even any open source derivative of LiveCode community has to, somehow, acknowledge LiveCode and LiveCode's role in that derivative?

After all, LC 963 contains references to MetaCard, which, in and of itself, was NOT Open Source.
https://richmondmathewson.owlstown.net/
Tom
Posts: 5
Joined: Fri Oct 20, 2023 7:43 am
Contact:

Re: Fix for macOS Sonoma

Post by Tom »

richmond62 wrote: Sat Oct 21, 2023 9:37 am Bless you Tom, and forgive me that I doubted you. 8-)
You're welcome, apology accepted! ;)
richmond62 wrote: Sat Oct 21, 2023 9:37 am Obviously the next question to ask is how you worked that out.
I attached the lldb debugger (included with Xcode) to LiveCode. It can show you exactly where the crash occurs. Then you can have it disassemble the machine code at that location and find out what the code was doing when it crashed. For the backdrop problem (which wasn't a crash) I looked up the Cocoa routine for arranging windows and then searched the code for places where that routine was called.
richmond62 wrote: Sat Oct 21, 2023 9:37 am I shall also have a go with LC 961 for the sake of 32-bit standalones.
This won't work because the problematic routines won't be at the exact same locations in the machine code for other versions of LiveCode. But no worries, I have also finished and attached patches for the other two versions you mentioned. (I understand LC 961, but what is the advantage of 8.1.10? Just curious). Here are the updated instructions so you don't have to mess with all the paths yourself:

Code: Select all

sudo xxd -r ~/Desktop/patch1_8_1_10.hex /Applications/LiveCode\ Community\ 8.1.10.app/Contents/MacOS/LiveCode-Community
sudo xxd -r ~/Desktop/patch2_8_1_10.hex /Applications/LiveCode\ Community\ 8.1.10.app/Contents/Tools/Runtime/Mac\ OS\ X/x86-32/Standalone.app/Contents/MacOS/Standalone-Community
sudo codesign -f -s- --deep /Applications/LiveCode\ Community\ 8.1.10.app/Contents/Tools/Runtime/Mac\ OS\ X/x86-32/Standalone.app
sudo codesign -f -s- --deep /Applications/LiveCode\ Community\ 8.1.10.app


sudo xxd -r ~/Desktop/patch1_9_6_1.hex /Applications/LiveCode\ Community\ 9.6.1.app/Contents/MacOS/LiveCode-Community
sudo xxd -r ~/Desktop/patch2_9_6_1.hex /Applications/LiveCode\ Community\ 9.6.1.app/Contents/Tools/Runtime/Mac\ OS\ X/x86-32/Standalone.app/Contents/MacOS/Standalone-Community
sudo codesign -f -s- --deep /Applications/LiveCode\ Community\ 9.6.1.app/Contents/Tools/Runtime/Mac\ OS\ X/x86-32/Standalone.app
sudo codesign -f -s- --deep /Applications/LiveCode\ Community\ 9.6.1.app
tperry2x wrote: Fri Oct 20, 2023 8:54 pm Your patch seems to work fine in OpenXtalk lite as that is based on 9.6.3 community and the binaries themselves aren't modified, just the supporting stacks and resources over time, so I thought it would run exactly the same.
Ah, I see, in that case it should indeed work!
Attachments
patches_for_previous_versions.zip
(1.55 KiB) Downloaded 254 times
User avatar
richmond62
Posts: 3896
Joined: Sun Sep 12, 2021 11:03 am
Location: Bulgaria
Contact:

Re: Fix for macOS Sonoma

Post by richmond62 »

The Advantage with 9.6.1 is that it can make 32-bit Mac standalones.

There is no obvious advantage with 8.1.10 (although I shall patch a copy with your wonderful tricks) beyond that it was 'there' on my MacOS Monterey iMac and I thought I would 'give it a bash'.

However: I am not sure where to look for 'patch1_8_1_10.hex" and 'patch1_9_6_1.hex'.
https://richmondmathewson.owlstown.net/
User avatar
richmond62
Posts: 3896
Joined: Sun Sep 12, 2021 11:03 am
Location: Bulgaria
Contact:

Re: Fix for macOS Sonoma

Post by richmond62 »

I am wondering about the legality of putting patched versions inside DMG images and making them publicly available.

BUT I will defer to FourthWorld first.
https://richmondmathewson.owlstown.net/
Tom
Posts: 5
Joined: Fri Oct 20, 2023 7:43 am
Contact:

Re: Fix for macOS Sonoma

Post by Tom »

richmond62 wrote: Sat Oct 21, 2023 8:19 pm There is no obvious advantage with 8.1.10 (although I shall patch a copy with your wonderful tricks) beyond that it was 'there' om my MacOS Monterey iMac and I thought I would 'give it a bash'.
That makes sense. 8-)
richmond62 wrote: Sat Oct 21, 2023 8:19 pm However: I am not sure where to look for 'patch1_8_1_10.hex" and 'patch1_9_6_1.hex'.
Oops, somehow the attachment got lost. I distinctly remember not having forgotten it. I must have clicked the wrong button somewhere. I have added the attachment above.
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests