How to enable App sandbox for a python app on OSX (The python app is targeted for Mac App Store)

StackOverflow https://stackoverflow.com/questions/16051478

  •  04-04-2022
  •  | 
  •  

Question

First of all, the python app is targeted for Mac App Store. And Apple emailed me that my app was not sandbox enabled.

As below:

Dear developer,

We have discovered one or more issues with your recent delivery for "InternetWorks". To process your delivery, the following issues must be corrected:

App sandbox not enabled - The following executables must include the "com.apple.security.app-sandbox" entitlement with a Boolean value of true in the entitlements property list. Refer to the App Sandbox page for more information on sandboxing your app.

InternetWorks.app/Contents/MacOS/InternetWorks

Once these issues have been corrected, go to the Version Details page and click "Ready to Upload Binary." Continue through the submission process until the app status is "Waiting for Upload." You can then deliver the corrected binary.

Regards,

The App Store team

Since my app is wrote in Python, i have no idea of how to make a entitlements property list for it.

From Apple's documentation, the entitlements property list was created inside a Xcode project, and somehow related with the executable file. But again, my app was wrote in Python, it just a couple of *.py files in essential, and i have packed it to a "my_app_name.app" executable file using py2app/cx_Freeze tools.

So, is is possible to create/make a entitlements property list file for my already packed python app(My_App_name.app file) manually and how can i do it without a XCode project?

Thanks in advance.

Was it helpful?

Solution

For some context the interface to configure your .entitlements in looks like this screenshot.

It automatically creates a file in your $(SOURCE_ROOT) called AppName.entitlements.

.plists are the XML files Apple uses for almost everything that would be a text config file on a 'traditional' unix. If you're developing in Python on OSX you may find the Python plistlib helpful. The Apple blessed way to edit them is using XCode itself (before XCode4 there was a stand-alone Property List Editor.app).

In this case the default they want merely contains:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>com.apple.security.app-sandbox</key>
    <true/>
</dict>
</plist>

I suspect if you simply paste that into a file named InternetWorks.entitlements you'll resolve their issue. Although you may need to request more of the available permissions.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top