Search code examples
python-3.xmacospyinstaller

Strange behavior of a MacOs app created with pyinstaller


I've created a PyQt Mac app with pyinstaller. When the app is launched, the app icon appears briefly in the dock, then disappears as if the application was closed and then reappears a few seconds later. The application seems to work as expected. I also have checked the processes and I've found that 2 processes were launched and one them was stalled (see below screen capture).

Is it the normal behavior of a Pyinstaller packaged app? Is there a way to correct this behavior?

enter image description here


Solution

  • If you have packaged your app with --onefile/-F mode, the initial process (that briefly appears) is the part where all the package contents are unpacked into a temporary directory before the final application launch. The only way to correct it would be to use the --onedir mode, which creates a package directory with uncompressed files.

    This has been documented in How the One-File Program Works section

    The bootloader uncompresses the support files and writes copies into the the temporary folder. This can take a little time. That is why a one-file app is a little slower to start than a one-folder app.