Is it possible to embed bash shell in my app?

Hope this is not a stupid question, but I'd like to embed or integrate a bash shell into my sandboxed app (and manipulate its environment variables). Is it even possible? Any ideas and suggestions will be appreciated.

Replies

In general, Mac App Store apps can embed and execute command line tools just fine. In the specific case of

bash
there may be some added complexities.

On the technical front,

bash
is a complex tool and it’s possible it could run into sandbox restrictions. There’s no easy way to check for these issues in advance; your only real option is to try it in this environment and see what happens.

My other concerns are not technical but business:

  • Given

    bash
    ’s licence, I recommend you talk to a lawyer before embedding it in your product.
  • Shell scripts could reasonably be consider code, so you have to make sure you don’t trip over the App Review guidelines about downloading and executing code.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Thanks for the reply.

What triggered me on this question is that I see some gnu tools have a Terminal plugin window that let users interact just as they do in a real Terminal app. I actually was aware that it's most likely not feasible to do this in a sandboxed app, but also was hoping it could be possible.

What triggered me on this question is that I see some gnu tools have a Terminal plugin window that let users interact just as they do in a real Terminal app.

There’s no fundamental reason why this wouldn’t work in a sandboxed app, but there’s definitely a lot of fiddly details you’d have to work out. One of those would be getting the shell (and other tools) to work nicely in a sandboxed environment. I covered that in my previous post. Another is simply creating a terminal window; that’s much harder than you might think.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"