1

I have a menu bar app on macOS that gives shortcuts to some workflows. I want one of the buttons in this app to create a new terminal window which automatically runs a kubectl command. For example the user gets a terminal window as if they have ran that command by themselves.

I have figured that you can run terminal commands using Process() class. However, it doesn't create a new terminal window. Moreover, it terminates after command is done. I want something that stays open and yields to control to the user after it runs the initial command.

Does anyone know how this could be done? Do I need certain app permissions to do this?

My deployment target is 10.15 and Xcode 9.3 compatible.

Ege E.
  • 11
  • 3
  • There’s a few apps that I know of that do this, like SourceTree and Fork. I suspect they use the accessibility API to launch the terminal and enter in the command, but you can investigate them – Alexander Mar 28 '21 at 19:24
  • https://stackoverflow.com/questions/4404242/programmatically-launch-terminal-app-with-a-specified-command-and-custom-colors#7820639 – Shadowrun Mar 28 '21 at 19:43
  • @Shadowrun Thanks a lot. The approved answer is what I was looking for in the link. – Ege E. Mar 28 '21 at 20:43

0 Answers0