Run each instance of an app in its own sandbox

Is it possible to run multiple instance of an app at the same time such that each instance is running in its own sandbox environment? For eg- Each app should have it's own ~/Library and other shared directories. Maybe something like chroot, but I am not sure it would be possible.

And by sandbox I really mean isolation, not necessarily macOS App Sandbox.

Answered by DTS Engineer in 802842022

Not really.

I mean, you can run the app from different user accounts, but I doubt that’s what you’re looking for.

Maybe something like chroot, but I am not sure it would be possible.

chroot exists on macOS, but it’s rarely does anything useful. That’s because macOS has execution context beyond the traditional BSD model — most notably, the Mach bootstrap namespace — and a lot of system functionality is accessed via that additional context. I talk about this in very general terms in Technote 2083 Daemons and Agents.

What’s your final goal here? Is this something you plan to use internally during development? Or something that you plan to ship to a wide range of users?

Share and Enjoy

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

Accepted Answer

Not really.

I mean, you can run the app from different user accounts, but I doubt that’s what you’re looking for.

Maybe something like chroot, but I am not sure it would be possible.

chroot exists on macOS, but it’s rarely does anything useful. That’s because macOS has execution context beyond the traditional BSD model — most notably, the Mach bootstrap namespace — and a lot of system functionality is accessed via that additional context. I talk about this in very general terms in Technote 2083 Daemons and Agents.

What’s your final goal here? Is this something you plan to use internally during development? Or something that you plan to ship to a wide range of users?

Share and Enjoy

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

Run each instance of an app in its own sandbox
 
 
Q