Open Terminal with Swift

Asked

Viewed 87 times

0

Can I ask my graphics program to open a terminal window by passing some commands with parameters? I’m using Swift for OS X, Grateful.

  • Your difficulty is about which command opens the terminal or integer set?

  • That would be the command that opens the terminal.

1 answer

0


To open any application you can use the command open. The argument -b allows you to identify the application through your package, so to open the terminal you can do so:

open -b com.apple.terminal

Now, if after that you want to run some script, I believe (and maybe it is the best option) you need to create an executable file and then include it in the above command. For example, if you have a file script sh., would look like this:

open -b com.apple.terminal script.sh

Remembering that this file must have the necessary permissions to be executed.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.