Skip to content

mobile-next/mobilecli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

23 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

mobilecli

A universal command-line tool for managing iOS and Android devices, simulators, emulators and apps from Mobile Next.

Features πŸš€

  • Device Management: List and manage connected iOS/Android devices and simulators
  • Screenshot Capture: Take screenshots from any connected device with format options (PNG/JPEG)
  • Device Control: Reboot devices, tap screen coordinates, press hardware buttons
  • Cross-Platform Support: Works with iOS physical devices, iOS simulators, Android devices, and Android emulators
  • Multiple Output Formats: Save screenshots as PNG or JPEG with quality control
  • App management: Launch app, terminate apps. Install and uninstall coming next ⏭️

Installation πŸͺ„

Prerequisites

  • go-ios (for iOS device management)
  • Android SDK with adb in PATH (for Android device support)
  • Xcode Command Line Tools (for iOS simulator support on macOS)

Install from Source

git clone https://github.com/mobile-next/mobilecli.git
cd mobilecli
make build

Install Dependencies

🍎 For iOS Support

# Install go-ios for iOS device management
brew install go-ios
# or
npm install -g go-ios

πŸ€– For Android Support

# Install Android SDK and ensure adb is in PATH
# Download from: https://developer.android.com/studio/command-line/adb
# or
brew install --cask android-platform-tools

Usage

List Connected Devices

# List all connected devices and simulators to your local or remote server
mobilecli devices

Example output:

[
  {
    "id": "12345678-1234567890ABCDEF",
    "name": "iPhone 15",
    "platform": "ios",
    "type": "real"
  },
  {
    "id": "emulator-5554",
    "name": "Pixel_7_API_34",
    "platform": "android", 
    "type": "emulator"
  }
]

Take Screenshots

# Take a PNG screenshot (default)
mobilecli screenshot --device <device-id>

# Take a JPEG screenshot with custom quality
mobilecli screenshot --device <device-id> --format jpeg --quality 80

# Save to specific path
mobilecli screenshot --device <device-id> --output screenshot.png

# Output to stdout
mobilecli screenshot --device <device-id> --output -

Device Control

# Reboot a device
mobilecli reboot --device <device-id>

# Tap at coordinates (x,y)
mobilecli tap --device <device-id> 100,200

# Press hardware buttons
mobilecli press-button --device <device-id> HOME
mobilecli press-button --device <device-id> VOLUME_UP
mobilecli press-button --device <device-id> POWER

Supported Hardware Buttons

  • HOME - Home button
  • BACK - Back button (Android only)
  • POWER - Power button
  • VOLUME_UP - Volume up
  • VOLUME_DOWN - Volume down

Platform-Specific Notes

iOS Real Devices

  • Currently requires that you install and run WebDriverAgent manually

iOS Simulators

  • Currently requires that you install and run WebDriverAgent manually

Development

Building

make build

Testing

make test

Linting

make lint

Project Structure

mobilecli/
β”œβ”€β”€ main.go              # CLI entry point and commands
β”œβ”€β”€ devices/             # Device management interfaces
β”‚   β”œβ”€β”€ common.go        # ControllableDevice interface
β”‚   β”œβ”€β”€ android.go       # Android device implementation
β”‚   β”œβ”€β”€ ios.go          # iOS real device implementation
β”‚   β”œβ”€β”€ simulator.go    # iOS simulator implementation
β”‚   └── wda.go          # WebDriverAgent client
└── utils/              # Utility functions
    β”œβ”€β”€ image.go        # Image conversion utilities
    β”œβ”€β”€ file.go         # File operations
    └── zipfile.go      # Archive operations

Roadmap

  • Webserver with json-rpc interface
  • Automatically install WebDriverAgent
  • Automatically create tunnel for iOS17+
  • App installation/management commands (install, removed, update)
  • Video streaming capabilities with WebRTC
  • Remote device management server
  • CI/CD pipeline improvements
  • Package distribution (Homebrew, etc.)

Support

For issues and feature requests, please use the GitHub Issues page.

About

Universal command-line tool for managing iOS and Android devices, simulators, emulators and apps

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •