macOS is Perry's primary development platform. It uses AppKit for native UI.
- macOS 13+ (Ventura or later)
- Xcode Command Line Tools:
xcode-select --install
# macOS is the default target
perry app.ts -o app
./appNo additional flags needed — macOS is the default compilation target.
Perry maps UI widgets to AppKit controls:
| Perry Widget | AppKit Class |
|---|---|
| Text | NSTextField (label mode) |
| Button | NSButton |
| TextField | NSTextField |
| SecureField | NSSecureTextField |
| Toggle | NSSwitch |
| Slider | NSSlider |
| Picker | NSPopUpButton |
| Image | NSImageView |
| VStack/HStack | NSStackView |
| ScrollView | NSScrollView |
| Table | NSTableView |
| Canvas | NSView + Core Graphics |
For distribution, apps need to be signed. Perry supports automatic signing:
perry publishThis auto-detects your signing identity from the macOS Keychain, exports it to a temporary .p12 file, and signs the binary.
For manual signing:
codesign --sign "Developer ID Application: Your Name" ./appperry app.ts -o MyApp
# Sign with App Store certificate
codesign --sign "3rd Party Mac Developer Application: Your Name" MyApp
# Package
productbuild --sign "3rd Party Mac Developer Installer: Your Name" --component MyApp /Applications MyApp.pkg- Menu bar: Full NSMenu support with keyboard shortcuts
- Toolbar: NSToolbar integration
- Dock icon: Automatic for GUI apps
- Dark mode:
isDarkMode()detects system appearance - Keychain: Secure storage via Security.framework
- Notifications: Local notifications via UNUserNotificationCenter
- File dialogs: NSOpenPanel/NSSavePanel
{{#include ../../examples/platforms/macos_system.ts:macos-system}}- iOS — Cross-compile for iPhone/iPad
- UI Overview — Full UI documentation
- System APIs — System integration