I have made an addon that when installed on Windows works perfectly fine. But when installed on Blender running on Mac OS, the binary contained within the addon zip file loses the execute permission. Here to prove that the execute permissions in -rwxrwxrwx@ were there before installation, when zip was downloaded and extracted into /Users/user/Downloads/:
user@macbook % pwd
/Users/user/Downloads/addon-name/executables/0.0.1/darwin/myexe.app/Contents/MacOS
user@macbook % ls -la
total 8840
drwxrwxrwx@ 3 user staff 96 Jan 19 09:46 .
drwxrwxrwx@ 6 user staff 192 Jan 19 09:46 ..
-rwxrwxrwx@ 1 user staff 4523992 Jan 18 01:19 executable-binary
But when I install the addon zip file in Blender running on Mac OS and check the directory /Users/user/Library/Application Support/Blender/4.0/scripts/addons/ where Blender puts the addon, I noticed that the binary has lost its execute permission in -rw-r--r-- and that's when my addon fails to function properly.
user@macbook % pwd
/Users/user/Library/Application Support/Blender/4.0/scripts/addons/addon-name/executables/0.0.1/darwin/myexe.app/Contents/MacOS
user@macbook % ls -la
total 8840
drwxr-xr-x 3 user staff 96 Jan 19 14:26 .
drwxr-xr-x 6 user staff 192 Jan 19 14:26 ..
-rw-r--r-- 1 user staff 4523992 Jan 19 14:26 executable-binary
My current workaround is to manually add the execute permissions to the binary using chmod +x executable-binary. All the other parent directories still have retained the execute permissions. It's just the binary that has lost it. I'm uncertain whether this behavior is a bug or intentional, but it seems unlikely to be intentional since it results in inconsistency, especially considering that it functions correctly on Windows. So my question is how do I properly deploy and install such an addon that uses third party executable binaries? So that I can properly communicate that to the users via documentation.
register()call, see my basic setup (tested on 4.0) based on a rather old answer. Does this help? – p2or Jan 23 '24 at 16:02os.chmod(executable_path, 0o755)be enough? – Harry McKenzie Jan 24 '24 at 07:06os.chmod(app, 0o755)works as well (tested on OSX), just wanted to use 'Pathlib' and provide a cross-platform solution: https://docs.python.org/3/library/pathlib.html#pathlib.Path.chmod – p2or Jan 24 '24 at 07:30