APP Settings/ Permissions to run scripts

I'm currently developing an app on Xcode 15 for macOS 14+ (Swift)

The app allows me to launch custom commands, using a simple UI to run them as opposed to having to open the Terminal app.

I have successfully been able to use the app to run some simple commands such as:

  • open "https://google.com"
  • open -a "Safari" && open -a "Mail" && open -a "Calendar"
  • say hi
  • shortcuts run “Lights Camera Action”

Unfortunately, if I try to open/run a shell script, I get an error in the Xcode console and the command fails to run.

For example:

If I create this simple shell script:

#!/bin/bash

osascript <<END 
tell application "Terminal"
    activate
    do script "top"
end tell
END

And try to run it using this command:

/"path"/run_in_new_terminal.sh

I get this error in the Xcode console:

bash: /"path"/run_in_new_terminal.sh: Operation not permitted

I am able to run the shell script directly from a terminal without issues, by using the same command, it just does not work using the APP.

/"path"/run_in_new_terminal.sh

I'm new to developing and software in general... This is the first thing that I've worked on, so I'm not sure if this is a simple APP permissions/sandbox settings problem or something that needs to be changed on the OS side (computer permissions etc).

Any help would be greatly appreciated! :)

What API calls are you using to execute the commands you describe from the app? After you make your script, are you making it executable? Are the scripts somewhere on the file system, or inside your app's bundle? Have you looked at the error messages in Console?

APP Settings/ Permissions to run scripts
 
 
Q