MacOS – Display interactive notifications (with buttons) via Terminal

bashcommand linemacossoftware-recommendation

I'd like to let my bash shell scripts to display gui notifications with two buttons that the user can click and then execute some commands depending on the button pressed.

What options exist?

Best Answer

I'm a big fan of Tkinter since it has far more tutorials that help a new person solve real problems and python/tk ship with all Macs and the versions have been stable for years of OS X releases.

To get started, run this command:

python -c "import Tkinter;Tkinter._test()"

If the free tutorials linked above aren't working for your needs, the professional ones on lynda and python classes like https://www.coursera.org/learn/python are fairly easy to get started with limited time or limited funds.

You could also start from the GUI with Platypus and have it call your desired bash scripts for each button that's pressed. You could then open the "app" with open -a to get things started.