Skip to content

mobile-next/mobilecli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

mobilecli

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

Mobile Next Stars Mobile Next Downloads npm Mobile MCP is released under the AGPL v3.0 License

Slack community channel

Features ๐Ÿš€

  • Device Management: List, manage, interactive with connected mobile devices
  • Cross-Platform Support: Works with iOS physical devices, iOS simulators, Android devices, and Android emulators
  • Screenshot Capture: Take screenshots from any connected device with format options
  • Multiple Output Formats: Save screenshots as PNG or JPEG with quality control
  • Screencapture video streaming: Stream mjpeg video directly from device
  • Device Control: Reboot devices, tap screen coordinates, press hardware buttons
  • App management: Launch app, terminate apps. Install and uninstall coming next โญ๏ธ

Installation ๐Ÿ“ฆ

Prerequisites ๐Ÿ“‹

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

Run instantly with npx

npx @mobilenext/mobilecli@latest

Install globally with npm

npm install -g @mobilenext/mobilecli@latest

Install from Source ๐Ÿ› ๏ธ

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

Install Dependencies

๐ŸŽ For iOS Simulator Support

Xcode is required. Make sure you have it installed with the runtimes relevant for you installed. You will have to create Simulators and have them booted before mobilecli can use them.

mobilecli will automatically install an agent on the device that is required for functionalities such as opening a url, tapping on buttons and streaming screen capture.

๐Ÿค– 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 -

Stream Screen ๐ŸŽฅ

mobilecli screencapture --device <device-id> --format mjpeg | ffplay -

Note that screencapture is one way. You will have to use io tap commands to tap on the screen.

Device Control ๐ŸŽฎ

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

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

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

# Send text
mobilecli io text --device <device-id> 'hello world'

Supported Hardware Buttons

  • HOME - Home button
  • BACK - Back button (Android only)
  • POWER - Power button
  • VOLUME_UP, VOLUME_DOWN - Volume up and down
  • DPAD_UP, DPAD_DOWN, DPAD_LEFT, DPAD_RIGHT, DPAD_CENTER - D-pad controls (Android only)

Platform-Specific Notes

iOS Real Devices

  • Currently requires that you install and run WebDriverAgent manually. You may change the BUNDLE IDENTIFIER, and mobilecli will be able to launch it if needed, as long as the identifier ends with *.WebDriverAgent.

Development ๐Ÿ‘ฉโ€๐Ÿ’ป

Building ๐Ÿ› ๏ธ

Please refer to (docs/TESTING.md) for further instructions regarding testing mobilecli locally.

make lint
make build
make test

Support ๐Ÿ’ฌ

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

Be sure to join our slack channel today ๐Ÿ’œ

To learn more about Mobile Next and what we're building, subscribe to our newsletter.

About

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

Topics

Resources

License

Stars

Watchers

Forks

Contributors 3

  •  
  •  
  •  

Languages