3

I used PyInstaller to build a mac os x app bundle for my python2.7 package. Double clicking the app icon momentarily popped up the console window but disappeared right away. However, double clicking the expanded "Contents/MacOS/executable" correctly popped up the expected window.

Following is a screen short for my expanded app contents. The Frameworks folder is empty, the Resources folder contains the icon, and the MacOS folder contents all the binary libraries and the executable (which is running ok as stated above). Not sure whether modifying the info.plist will help or not.

enter image description here

Hailiang Zhang
  • 17,604
  • 23
  • 71
  • 117

2 Answers2

1

Did you try using the -w flag? From the docs:

-w, --windowed, --noconsole

Use a windowed subsystem executable, which on Windows does not open the console when the program is launched. This option is mandatory when creating .app bundle on Mac OS X.

Muntashir Akon
  • 8,740
  • 2
  • 27
  • 38
pedram
  • 2,931
  • 3
  • 27
  • 43
  • 1
    Yes, I did use -w, otherwise I doubt .app will be generated – Hailiang Zhang Aug 22 '13 at 00:14
  • Have you tried PyInstaller 2.1 the development version? Currently has a number of bug fixes related to MAC OS X. – pedram Aug 22 '13 at 00:30
  • You mean the "Development" version under the "2.0" version in pyinstaller.org, right? Yes, this is the version I am trying right now, but it seems that I can't even build the simplest .app with "-w" option. – Hailiang Zhang Aug 22 '13 at 00:59
  • not working on Mojave with python 3.7.4 from python.org. – kakyo Aug 20 '19 at 03:51
0

I am not sure what this means: "Application is background only = YES" ?

I tried to replicate your problem with my app foo and the ...947 build of Pyinstaller (a recent, dev version.) I used --onefile --windowed args to Pyinstaller. I found that in the Finder, double clicking build/foo starts a console, and then the app window appears. While double clicking the bundle build/foo.app did not seem to start a console, and my app window appears. In other words, it works for me.

On the other hand, I tried another packager: Whitebox Packages In creating a package, I put the pyinstaller/foo/build/foo file (the executable) into the bundle. Etc. 'Packages' created a .mpkg file for me, which I installed. Then, when I invoked my app, a console did appear, and them my app's window. (Which is not good, I don't want a console.) I don't understand what attributes of the package make the app start without a console. I don't think it is the case that the executable include a shell that starts a console, it must be OSX that is starting the console.

Probably, it is not a high priority of the PyInstaller project to do 'packaging for distribution' correctly, since other tools exist.

bootchk
  • 1,926
  • 17
  • 14