Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

macOS

macOS is Perry’s primary development platform. It uses AppKit for native UI.

Requirements

  • macOS 13+ (Ventura or later)
  • Xcode Command Line Tools: xcode-select --install

Building

# macOS is the default target
perry app.ts -o app
./app

No additional flags needed — macOS is the default compilation target.

UI Toolkit

Perry maps UI widgets to AppKit controls:

Perry WidgetAppKit Class
TextNSTextField (label mode)
ButtonNSButton
TextFieldNSTextField
SecureFieldNSSecureTextField
ToggleNSSwitch
SliderNSSlider
PickerNSPopUpButton
ImageNSImageView
VStack/HStackNSStackView
ScrollViewNSScrollView
TableNSTableView
CanvasNSView + Core Graphics

Code Signing

For distribution, apps need to be signed. Perry supports automatic signing:

perry publish

This 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" ./app

App Store Distribution

perry 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

macOS-Specific Features

  • 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

System APIs

import { openURL, isDarkMode, preferencesSet, preferencesGet } from "perry/system";

openURL("https://example.com");          // Opens in default browser
const dark = isDarkMode();                // Check appearance
preferencesSet("key", "value");           // NSUserDefaults
const val = preferencesGet("key");        // NSUserDefaults

Next Steps