An Elixir package for managing Apple simulators with automatic lifecycle management using OTP supervision trees. Built on top of AXe for UI automation and Apple's simctl for simulator control.
- macOS only - Apple device management requires macOS
- Xcode Command Line Tools
- Elixir 1.14 or later
Add orchard
to your list of dependencies in mix.exs
:
def deps do
[
{:orchard, "~> 0.1.0"}
]
end
On first use, Orchard will automatically download the AXe CLI binary. You can also manually download it:
mix orchard.download
You can configure the AXe version or provide a custom path:
# config/config.exs
config :orchard,
axe_version: "1.0.0", # Optional: specify AXe version
axe_path: "/usr/local/bin/AXe" # Optional: use custom AXe binary
# List all simulators
{:ok, simulators} = Orchard.Simulator.list()
# Boot a simulator (starts a GenServer to manage it)
{:ok, simulator} = Orchard.Simulator.boot(simulator)
# The simulator is now managed by a GenServer that:
# - Monitors its state every second
# - Automatically terminates if the simulator is removed
# - Provides a supervised process for all operations
# Install an app on a simulator
:ok = Orchard.Simulator.install_app(simulator, "/path/to/app.app")
# UI Automation with AXe
:ok = Orchard.Simulator.tap(simulator, 100, 200)
:ok = Orchard.Simulator.type_text(simulator, "Hello World")
{:ok, ui_tree} = Orchard.Simulator.describe_ui(simulator)
# Take a screenshot
:ok = Orchard.Simulator.screenshot(simulator, "/tmp/screenshot.png")
# Shutdown the simulator
:ok = Orchard.Simulator.shutdown(simulator)
Orchard uses Erlang/OTP supervision trees to manage simulators and devices:
- Each booted simulator runs in its own
SimulatorServer
GenServer - The
SimulatorSupervisor
manages all simulator processes - Simulators are automatically monitored and cleaned up
- Crashed processes are restarted by the supervisor
- List all available simulators
- Boot and shutdown simulators
- Install and launch apps
- Automatic state monitoring via GenServers
- Supervised processes with automatic cleanup
- Tap at specific coordinates
- Type text
- Swipe gestures
- Hardware button presses
- Get accessibility hierarchy information
- Screenshot capture
- Video recording
- App installation/uninstallation
- Process supervision with MuonTrap
- macOS only - Requires Apple developer tools
- Automatic AXe CLI download and management
- Fails gracefully on unsupported platforms
Orchard combines several technologies:
- AXe CLI - For UI automation and simulator listing
- Apple's simctl - For simulator control operations
- Erlang/OTP - For process supervision and state management
- MuonTrap - For reliable system process management
When you boot a simulator, Orchard:
- Starts a dedicated GenServer process for that simulator
- Monitors the simulator's state every second
- Automatically cleans up if the simulator is removed
- Provides a consistent interface for all operations
The AXe binary is automatically downloaded on first use or can be manually downloaded using mix orchard.download
.
MIT