mac app from a python script?

Mats Wichmann mats at python.org
Mon Jan 24 10:30:41 EST 2022


On 1/23/22 10:59, Dan Stromberg wrote:
> Hi folks.
> 
> I have a Python 3 script (built on top of gi.respository.Gtk) that runs on
> Linux and macOS 11.5.  It's at https://stromberg.dnsalias.org/~strombrg/hcm/
> if you're curious.
> 
> It works the way I want on Linux, but on macOS I seem to have to start it
> from the command line, like:
>     hcm --gui
> ...because I don't know how to create a macOS "app" that goes under
> /Applications.
> 
> I don't really care about having a single executable on macOS, and I don't
> really care about creating a .dmg or .pkg file. I'd be perfectly happy just
> running "make install" and putting a #!'d script under /Applications with
> appropriate metadata - but if it's easier to do a single executable, .dmg
> or .pkg, I'd be fine with that.
> 
> I've experimented with a few different options for this (months ago),
> mostly py2app, but it doesn't appear to like gi.repository.Gtk much.
> 
> What's the most straightforward way of installing a Python script under
> /Applications on macOS?  I'd -love- to find a way of doing something
> analogous to Linux' desktop-file-install - that is, something that isn't
> click-happy, but GUI's are acceptable too if they'll get the job done.

There are notes on the topic here, see if they help:

https://docs.python.org/3/using/mac.html#how-to-run-a-python-script




More information about the Python-list mailing list