website/docs/publish/macos.md
import TabItem from '@theme/TabItem'; import Tabs from '@theme/Tabs';
Instructions for packaging a Flet app into a macOS application bundle.
:::tip[Info] This guide provides detailed macOS-specific information. Complementary and more general information is available here. :::
Flutter, which we use for packaging, requires Rosetta 2 on Apple Silicon:
sudo softwareupdate --install-rosetta --agree-to-license
Xcode 15 or later is required to compile native Swift or Objective-C code.
CocoaPods 1.16 or later is required to install and compile Flutter plugins.
flet build macos:::note[Note] This command can be run on macOS only. :::
Builds a macOS application bundle from your Flet app.
By default, flet build macos creates a universal bundle that runs on both
Apple Silicon and Intel Macs. Packaging downloads Python wheels for both
arm64 and x86_64 architectures.
To limit packaging to a specific architecture, see this. This affects which Python wheels are bundled and, in turn, which CPU architectures the app will run on. You will then have to provide your users with the correct build for their Macs.
macOS permissions are declared through Info.plist privacy usage strings and
app entitlements. You can also use the cross-platform permission bundles
to inject common entries, then override or extend them with platform-specific values.
Add or override Info.plist entries for macOS builds.
These values are written to macos/Runner/Info.plist of the build project.
Its value is determined in the following order of precedence:
--info-plist[tool.flet.macos.info]true or false (case-insensitive) for boolean values32 or 0.5["basic", "advanced"]{ NSAllowsArbitraryLoads = false }In the macos/Runner/Info.plist, the
example above will be translated accordingly into this:
<plist version="1.0">
<dict>
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>NSSupportsSuddenTermination</key>
<true/>
<key>ExampleInteger</key>
<integer>32</integer>
<key>ExampleReal</key>
<real>0.5</real>
<key>SupportedModes</key>
<array>
<string>basic</string>
<string>advanced</string>
</array>
<key>FeatureFlags</key>
<array>
<true/>
<false/>
</array>
<key>RetryDelays</key>
<array>
<integer>1</integer>
<integer>2</integer>
<integer>3</integer>
</array>
<key>OpacitySteps</key>
<array>
<real>0.25</real>
<real>0.5</real>
<real>0.75</real>
</array>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<false/>
</dict>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeName</key>
<string>Data File</string>
<key>CFBundleTypeExtensions</key>
<array>
<string>dat</string>
</array>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>JSON File</string>
<key>CFBundleTypeExtensions</key>
<array>
<string>json</string>
</array>
</dict>
</array>
</dict>
</plist>
Entitlements are property-list key-value pairs that grant an executable permission to use a service or technology. The supported value type depends on the entitlement key defined in the Apple Developer Entitlements Reference.
Entitlements are written to macos/Runner/DebugProfile.entitlements and
macos/Runner/Release.entitlements in the build template.
Its value is determined in the following order of precedence:
[tool.flet.macos.entitlement]
Values injected by cross-platform permission bundles, if any.
Defaults:
[tool.flet.macos.entitlement]
"com.apple.security.app-sandbox" = false
"com.apple.security.cs.allow-jit" = true
"com.apple.security.network.client" = true
"com.apple.security.network.server" = true
"com.apple.security.files.user-selected.read-write" = true
true or false (case-insensitive) for boolean values32 or 0.5["group.example.one", "group.example.two"]{ "com.apple.mail" = ["compose"] }In both macos/Runner/DebugProfile.entitlements and
macos/Runner/Release.entitlements, the example above
will be translated accordingly into this:
<key>com.apple.security.network.client</key>
<true />
<key>com.apple.developer.ubiquity-kvstore-identifier</key>
<string>ABCDE12345.dev.example.myapp</string>
<key>ExampleInteger</key>
<integer>32</integer>
<key>ExampleReal</key>
<real>0.5</real>
<key>com.apple.security.application-groups</key>
<array>
<string>group.dev.example.myapp</string>
<string>group.dev.example.shared</string>
</array>
<key>ExampleBooleanArray</key>
<array>
<true />
<false />
</array>
<key>com.apple.security.scripting-targets</key>
<dict>
<key>com.apple.mail</key>
<array>
<string>compose</string>
<string>send</string>
</array>
</dict>
<key>ExampleArrayOfDictionaries</key>
<array>
<dict>
<key>Name</key>
<string>alpha</string>
<key>Enabled</key>
<true />
</dict>
<dict>
<key>Name</key>
<string>beta</string>
<key>Enabled</key>
<false />
</dict>
</array>