MacOS – Launch a sh program at startup attached to a terminal window


How is it possible to load (with terminal attached window) sh program at OSx startup ?

I see a lot of article on launchctl but it's obviously not possible to open a terminal windows attached to the process. Specifically I am looking to run a specific script which is in the sh file (call for a python program. I have to see the echo / print of the program, so to have a terminal attached to the execution).

Best Answer

Your use case is simple enough to just save your script to a file named with the .command file extension so that is chosen to open it. It needs to be user executable as well. Simply add that file to the user's Login Items in System Preferences.

The script is invoked with an ; exit tacked on to the end so you can see and copy the results before dismissing that window each time you login.

enter image description here