问题
For great help from stackoverflow, the development for the Mac version of my program is done. Now I need to deploy my program, and I was wondering if there is any way to "hide" my running Python code (it also runs .so library and it seems it makes a dock item to appear).
The program is supposed to be running in the background and it would be great if I can hide any terminal or dock items. In Windows or linux, it was easy, but I am still not that used to Mac and could not figure out how to do this.
Thank you, Joon
回答1:
Are you using py2app and distributing a package? If so, you can set LSBackgroundOnly in info.plist.
right-click on your package
choose *Show Package Contents*
double click on info.plist in Contents to open the property list editor
Add Child "Application is background only"
(That makes the application invisible. If your application has a UI and you just want to hide the dock icon, use LSUIElement, which is "Application is agent" in the property list editor.)
回答2:
have you tried using the nohup? lets say you have a launch script to start your program:
launch.sh:
nohup your_program & exit
来源:https://stackoverflow.com/questions/3853038/run-a-python-script-and-a-compiled-c-code-without-terminal-or-dock-item-in-mac-o