Cairo .dylib bundle problem on MacOS

18 views
Skip to first unread message

Judah Evangelista

unread,
Jan 30, 2023, 5:11:57 AM1/30/23
to PyInstaller
Hello all,

I am a grad student working on my first Python program, and I am looking for some help with a wall I’m running up against. I am new to the world of coding, and I am beginning to realize that getting my program to run on MacOS is not as simple as I had thought. To briefly summarize:

·        On Windows, using pyinstaller with the “--onefile” option works great; my script and all its dependencies are compiled into a single executable file that works on any PC.

·        On Mac, the resulting executable from “--onefile” is much smaller. It works on my Mac, but when I transfer it to another Mac via flash drive, I get several “missing library” errors upon launch. I’ve tracked the problem to a handful of .dylib files related to the open-source “cairo” graphics library (which is installed on my Mac, and my program needs for its primary function; however, for my intended user base of non-developers, I do not expect others to have this installed).

·        If I locate these .dylib files and copy them into my executable’s folder, I can now get my program to run on another Mac, as long as it is launched within this folder. However, if I try to transfer the entire folder via Internet (e.g., GitHub or email) and run the executable after downloading, all of the .dylib files trigger an error: “example.dylib cannot be opened because it is from an unidentified developer”.

·        I’ve since learned about “code signing” and some other basics of Apple software distribution, and my understanding is that I can avoid these security flags by a) organizing my executable and dylib files in a proper App Bundle structure, and b) signing all of the files with a valid Apple Developer ID.


Unfortunately, I do not have a developer ID, and obtaining one costs $99/year. I am willing to do this if necessary, but before I pull the trigger I thought I would reach out and ask if there is any simpler workaround. Is it possible to run pyinstaller on Mac in a way that will result in a complete executable, with all dependent dynamic libraries compiled into a single file (similar to how it seems to work on Windows)? Or do I have to fork over the money to Apple and properly sign my code before I can distribute my program to Mac users?

 

I’m happy to provide other details if they would be helpful.

 

Thanks for any and all help,

Judah

Reply all
Reply to author
Forward
0 new messages