Skip to content

macOS: Deal with App Sandbox

Takashi Kawasaki edited this page Dec 17, 2024 · 7 revisions

For macOS, Flutter app restricts its capability by enabling App Sandbox by default. You can change the behavior by editing your app's entitlements files depending on your configuration.

Deal with App Sandbox

The easiest option to access files on your local storage (i.e. SSD or HDD), set com.apple.security.app-sandbox to false on your entitlements file though it is not recommended for releasing apps because it completely disables App Sandbox.

Another option is to use com.apple.security.files.user-selected.read-only along with file_selector_macos. The option is better in security than the previous option.

Anyway, the example code for the plugin illustrates how to download and preview internet hosted PDF file. It uses com.apple.security.network.client along with flutter_cache_manager:

<dict>
  <key>com.apple.security.app-sandbox</key>
  <true/>
  <key>com.apple.security.network.client</key>
  <true/>
</dict>