LumeGuideFundamentals

Unattended Setup

Automate macOS Setup Assistant with YAML configuration files

Lume supports unattended setup automation to configure macOS VMs without manual interaction. This uses VNC-based automation with OCR (Optical Character Recognition) to navigate through the Setup Assistant and perform post-setup configuration.

Version Compatibility: Unattended configurations are specific to macOS versions. The Setup Assistant screens, button labels, and navigation flow can change between macOS releases. A configuration built for macOS Tahoe may not work on Sequoia or future versions.

Quick Start

There are two ways to use unattended setup:

Option 1: During VM Creation

Use the --unattended flag with lume create to install from IPSW and automatically run the Setup Assistant:

# Using a built-in preset
lume create my-vm --os macOS --ipsw latest --unattended tahoe

# Using a custom config file
lume create my-vm --os macOS --ipsw latest --unattended path/to/config.yml

# With debug mode enabled
lume create my-vm --os macOS --ipsw latest --unattended tahoe --debug

This will:

  1. Create the VM and install macOS from the IPSW
  2. Boot the VM (without opening VNC client by default)
  3. Automatically run through the Setup Assistant using your configuration

Additional options for lume create --unattended:

OptionDescription
--debugSave screenshots with OCR annotations for debugging
--debug-dirCustom directory for debug screenshots
--no-displayDon't open VNC client (default: true for unattended)
--vnc-portVNC server port (default: 0 for auto-assign)

Option 2: On an Existing VM

Use the lume setup command on a freshly created VM that hasn't completed the Setup Assistant:

# First, create a VM without unattended setup
lume create my-vm --os macOS --ipsw latest

# Later, run the unattended setup with a preset
lume setup my-vm --unattended tahoe

# Or with a custom config file
lume setup my-vm --unattended path/to/config.yml

This is useful when you want to:

  • Reuse a VM that failed during setup
  • Apply different configurations to cloned VMs
  • Debug setup issues interactively before automating

Built-in Presets

Lume includes built-in configuration presets that you can reference by name:

PresetDescription
tahoeFull macOS Tahoe Setup Assistant automation (creates user lume with password lume, enables SSH)
# Use the tahoe preset during creation
lume create my-vm --os macOS --ipsw latest --unattended tahoe

YAML Schema

The unattended configuration file uses YAML format with three main sections:

# Seconds to wait after VM boots before starting automation
boot_wait: 30

# Sequence of commands to execute
boot_commands:
  - '<command>'
  - '<command>'
  # ...

# Optional health check to verify setup success
health_check:
  type: ssh
  user: lume
  password: lume

Configuration Fields

FieldTypeRequiredDefaultDescription
boot_waitintegerNo60Seconds to wait for VM to boot before starting automation
boot_commandsarrayYes-List of automation commands to execute
health_checkobjectNo-Health check configuration to verify setup success

Health Check Configuration

FieldTypeRequiredDefaultDescription
typestringYes-Type of health check (ssh)
userstringNo-Username for SSH authentication
passwordstringNo-Password for SSH authentication
timeoutintegerNo30Timeout in seconds for each attempt
retriesintegerNo3Number of retry attempts
retry_delayintegerNo5Seconds to wait between retries

Boot Commands

Boot commands are strings enclosed in angle brackets that control mouse, keyboard, and timing.

Timing Commands

CommandDescriptionExample
<delay N>Wait N seconds (supports decimals)<delay 2>, <delay 0.5>
<wait 'text'>Wait for text to appear on screen (OCR)<wait 'Continue'>
<wait 'text', timeout=N>Wait with custom timeout (default: 120s)<wait 'Siri', timeout=300>

Mouse Commands

CommandDescriptionExample
<click 'text'>Click on detected text<click 'Continue'>
<click 'text', index=N>Click Nth occurrence (0=first, -1=last)<click 'Agree', index=-1>
<click 'text', xoffset=N>Click with horizontal offset<click 'Option', xoffset=50>
<click 'text', yoffset=N>Click with vertical offset<click 'Label', yoffset=30>
<click_at X,Y>Click at exact coordinates<click_at 960,540>

Index parameter: When text appears multiple times on screen (e.g., "Agree" in both license text and button), use index to select which occurrence:

  • index=0 - First (topmost) occurrence
  • index=1 - Second occurrence
  • index=-1 - Last (bottommost) occurrence
  • index=-2 - Second to last occurrence

Keyboard Commands

Special Keys

CommandDescription
<enter> or <return>Press Enter/Return key
<tab>Press Tab key
<space>Press Spacebar
<esc> or <escape>Press Escape key
<backspace>Press Backspace key
<delete>Press Delete key
<up>, <down>, <left>, <right>Arrow keys
<f1> through <f12>Function keys

Text Input

CommandDescriptionExample
<type 'text'>Type a string of text<type 'username'>

Hotkey Combinations

Combine modifier keys with +:

ModifierAliases
Commandcmd, command, super
Shiftshift
Optionalt, option
Controlctrl, control

Examples:

  • <cmd+space> - Open Spotlight
  • <cmd+q> - Quit application
  • <cmd+c> - Copy
  • <cmd+v> - Paste
  • <ctrl+alt+delete> - Multi-key combo
  • <shift+cmd+3> - Screenshot

Example: Full macOS Setup

This example walks through macOS Tahoe's Setup Assistant:

boot_wait: 30

boot_commands:
  # Dismiss greeting screen
  - '<delay 5>'
  - '<space>'
  - '<delay 2>'

  # Language selection
  - "<wait 'English', timeout=120>"
  - "<type 'English'>"
  - '<delay 1>'
  - '<enter>'
  - '<delay 2>'

  # Country/Region
  - "<wait 'Country or Region'>"
  - '<click_at 960,900>' # Click list to focus
  - "<type 'United States'>"
  - '<enter>'
  - "<click 'Continue'>"
  - '<delay 2>'

  # Transfer Your Data - select "Set up as new"
  - "<wait 'Transfer Your Data'>"
  - '<delay 20>'
  - '<tab>'
  - '<tab>'
  - '<tab>'
  - '<space>' # Select "Set up as new"
  - "<click 'Continue'>"

  # Skip remaining screens...
  - "<wait 'Accessibility'>"
  - "<click 'Not Now'>"

  # Create account
  - "<wait 'Create a Mac Account'>"
  - '<tab><tab><tab><tab><tab><tab>' # Tab to Full Name field
  - "<type 'lume'>"
  - '<tab><tab>' # Skip to Password
  - "<type 'lume'>"
  - '<tab>'
  - "<type 'lume'>" # Verify password
  - '<tab><tab><space>' # Uncheck Apple Account reset
  - "<click 'Continue'>"

  # Terms and Conditions
  - "<wait 'Terms and Conditions'>"
  - "<click 'Agree', index=-1>" # Click button, not text
  - "<wait 'I have read and agree'>"
  - "<click 'Agree', index=0>" # Click modal button

health_check:
  type: ssh
  user: lume
  password: lume
  timeout: 30
  retries: 5
  retry_delay: 10

Debugging

Enable debug mode to save screenshots with OCR annotations. Debug flags work with both lume setup and lume create --unattended:

# Using lume setup
lume setup my-vm --unattended tahoe --debug

# Using lume create with unattended setup
lume create my-vm --os macOS --ipsw latest --unattended tahoe --debug

# Save screenshots to custom directory (both commands support this)
lume setup my-vm --unattended tahoe --debug --debug-dir /path/to/debug
lume create my-vm --os macOS --ipsw latest --unattended tahoe --debug --debug-dir /path/to/debug

By default, debug screenshots are saved to a unique folder in the system temp directory (e.g., /tmp/unattended-<uuid>).

Debug screenshots show:

  • OCR-detected text with bounding boxes
  • Click target coordinates
  • Command being executed

Tips for Writing Configurations

Handling Timing

  • Use generous <delay> values between commands
  • Increase boot_wait if automation starts before the VM is ready
  • Use <wait 'text', timeout=N> for screens that load slowly

OCR Text Matching

  • Text matching is case-sensitive
  • Wait for unique text that identifies the screen before clicking
  • If text appears multiple times, use index parameter

Keyboard Navigation

macOS requires full keyboard access to Tab through all UI elements:

- "<type 'defaults write NSGlobalDomain AppleKeyboardUIMode -int 3'>"
- '<enter>'

System Settings Automation

Some settings can only be changed through GUI (protected by SIP):

  • Full Disk Access requires navigating System Settings
  • Use Spotlight (<cmd+space>) to search for specific settings

Screen Coordinates

  • Default VM resolution is 1920x1440 (Retina-scaled)
  • Use <click_at X,Y> when text detection is unreliable
  • Center of screen is approximately <click_at 960,720>

Troubleshooting

IssueSolution
Commands execute too earlyIncrease boot_wait or add <delay> commands
Text not foundCheck exact spelling/case, increase timeout, use coordinates instead
Wrong element clickedUse index parameter to select correct occurrence
Hotkeys don't workClick on desktop first to give it focus
Tab navigation skips elementsEnable full keyboard access with AppleKeyboardUIMode

Limitations

  1. OCR accuracy: Text detection depends on screen resolution and font rendering
  2. Version-specific: Setup Assistant flow changes between macOS versions
  3. No conditional logic: Commands execute sequentially without branching
  4. Single display: Coordinates assume single display at native resolution

Was this page helpful?