Run a python script and a compiled c code without terminal or dock item in Mac OS X

廉价感情. 提交于 2021-02-10 05:11:55

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!