TokisanGames/Terrain3D

Distribute signed binaries for MacOS

Opened this issue · 8 comments

phire commented

Apple have gone out of their way to make it painful to run unsigned binaries downloaded from the internet.

Every time you install the add-on into a project, you have to

  1. Launch Godot
  2. Click Cancel when the dialog offers to delete the .dynlib
  3. Open system preferences
  4. Navigate to Privacy and Security
  5. Scroll down to Security, find the "libterrain.macos.debug was blocked from use because it's not from an identified developer" (which doesn't show up until after you hit cancel the first time)
  6. Click "Allow Anyways"
  7. Switch back to Godot and Click Cancel a second time.
  8. Finally, the third dialog will finally allow you to click "Open" to bypass the security and run the unsigned binary.

You then have to repeat this when running the release version of the project. And end users will need to follow these complex steps too.

Also, there appears to be a bug. Depending on exactly how many times you hit cancel during launch, Godot will corrupt all external references in the project, which breaks demo project. Took me a long time to work out why the demo project wasn't working for me.

I just ran into this. The above steps did resolve my problem, but it would be beneficial if this wasn't required.

@mccolljr Thanks for the confirmation.

These steps are good enough for testing and development. When it comes to release, someone needs to pay Apple for a developer account and sign the binaries. That's either me or you. I don't have a mac, nor enough macos users, nor income generated from macos games sales (exactly $0) to justify paying them at this time. On the other hand, gamedevs who plan to release on macos/ios are already paying Apple so they can sign their own binaries. Once setup, it's only a few more minutes to build Terrain3D and sign it with that key.

You can read the journey of Godot's signing here, which didn't happen until they had ~20k users, 5 years after its first release.

That's fair. I wouldn't expect anyone to pay Apple's ridiculous price when they aren't making any money on the signed thing. Are you open to documentation enhancements to clarify the necessary steps for macos users to use the pre-built binaries? If so, I would be happy to contribute something as long as you can point me to where I should make changes.

Yes, of course I'll take documentation updates. Please update the instructions above, even with screenshots if you like, right here. I can make a documentation page for it like I did with mobile/web.

Sounds good. I will spend some time this weekend and write something up.

Just FYI, you can just get rid of the download quarantine attribute, which is what is causing this issue. Just cd to the terrain_3d directory and run this command:

find . -type f -exec xattr -r -d com.apple.quarantine {} \;

After doing this, you won't have any pop-ups about untrusted files.

(If you're leery of running this command, I understand -- run man xattr to learn more about it, and the find . -type f just finds all files recursively and applies this command. com.apple.quarantine is the attribute we're removing.)

(Also note: I haven't gotten Terrain3D working on macOS yet, unfortunately -- even the demo code. I'm getting a parse error for editor.gd: res://addons/terrain_3d/editor.gd:13 - Parse Error: Could not find type "Terrain3D" in the current scope. ... still working through the troubleshooting steps.)

@jamonholmgren Thanks for the tip. That message means you don't have a binary library accessible for Godot to load, because you didn't download the binary release build, the files are in the wrong place, you didn't build the source yourself, or apple security is preventing access.

I see you updated your note on the other thread. Please update your note and instructions here so we have the full set for working with Apple security with the distributed binaries.

I received a note from a discord user:

A quick search didn't yield anything, but I repeatedly got “libterrain.macos.debug” cannot be opened because the developer cannot be verified. macOS cannot verify that this app is free from malware. when I tried installing fresh using terrain3d-0.9.2-beta.zip along with a Unable to load addon script from path: 'res://addons/terrain_3d/editor.gd'. This might be due to a code error in that script.

Took a moment, but running

terrain3d-0.9.2-beta hat$ xattr -dr com.apple.quarantine addons/terrain_3d/bin/libterrain.macos.debug.framework/libterrain.macos.debug
terrain3d-0.9.2-beta hat$ xattr -dr com.apple.quarantine addons/terrain_3d/bin/libterrain.macos.release.framework/libterrain.macos.release

did the trick on Sonoma 14.6.1 (23G93).

https://discord.com/channels/691957978680786944/1130291534802202735/1285034889447739422


It seems these instructions are the simplest. macOS docs are now updated at this link. Let me know right here if you macos or ios users find specific notes that should be documented.
https://terrain3d.readthedocs.io/en/latest/docs/platforms.html