Bundle A Command Line Tool With MacOS Sandbox App

Hello, I'm buiding a macos app where I bundled a command line tool (Python) with my app. I put the tool in ****.app/Contents/MacOS folder, but it seems like the tool can not execute/read/ access. I don't know if a sandbox app can access/create a folder inside ****.app/Contents folder???

If not where can I put the tool that can access from my macos app?

Any idea would be appreciated!

Answered by DTS Engineer in 827110022

You can find my general advice on this topic in Embedding a command-line tool in a sandboxed app.

However, embedding Python is a non-trivial exercise because it relies on a whole bunch of additional infrastructure. Instead of starting out with Python, I recommend that you try embedding a much simpler command-line tool, for example, some simple tool that you install via Homebrew. Once you get that work, you know that you’re got the basics of embedding and executing the tool working correctly. You can then start thinking about how you want to tackle Python.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

You can find my general advice on this topic in Embedding a command-line tool in a sandboxed app.

However, embedding Python is a non-trivial exercise because it relies on a whole bunch of additional infrastructure. Instead of starting out with Python, I recommend that you try embedding a much simpler command-line tool, for example, some simple tool that you install via Homebrew. Once you get that work, you know that you’re got the basics of embedding and executing the tool working correctly. You can then start thinking about how you want to tackle Python.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

It’s better to reply as a reply, rather than in the comments; see Quinn’s Top Ten DevForums Tips for this and other titbits.

But I'm wondering where I can place the tool that I can execute/access/creating folder... Is it possible to do?

I need more details to answer that:

  • Are you proposing to embed a copy of that tool in your app? Or do you want to run the tool from the location that Homebrew installed it?

  • Regarding the tool itself, are you expecting it to operate on files stored outside of your app’s container? Or is your app running with files stored in the app’s container?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Bundle A Command Line Tool With MacOS Sandbox App
 
 
Q