Mason Docs

Mason Platform CLI

The Mason CLI provides command line tools to help you manage and configure your devices in the Mason Platform.

Typical uses for the Platform CLI include and are not limited to

  • Integrating Mason OS deployments and updates in your CI/CD pipelines
  • A/B testing different versions of your app on different Mason devices
  • Configuring different versions of Mason OS for your devices
  • Debugging devices with X-Ray
  • ...and more!

This CLI will only work for X-Ray if the device is running Mason OS 6.0.6+. If you are trying to use X-Ray on a device running an older version of Mason OS please visit the previous Mason CLI's documentation


Install

Visit our installation guide to get the CLI up and running on your platform

API Keys

To configure API Keys, rather than supplying on each command, you can make use of the MASON_API_KEY environment variable.

export MASON_API_KEY=<YOUR_KEY>
mason help

CLI Commands

mason help

The mason help command displays information about the Mason CLI.

The --help option can be combined with any command to get a detailed explanation of how to use it.

Variants

mason help
mason help [COMMAND]
mason [COMMAND] --help

mason xray

The xray command allows you to interact with your devices remotely.

Need help getting started? Visit our guide on setting up xray

mason xray logcat

The xray logcat command streams logs from the device to your terminal.

this command requires an API Key with the permission XRAY:ADMIN to be configured in the Mason CLI. Visit our guide for configuring an API Key with the Mason CLI if you need help with this.

In order for mason xray logcat to succeed, you must supply a deviceId, and (optionally) any additional arguments.

Arguments

  -b, --buffer string      log buffer on remote device to describe (main, system, crash, etc.)
  -l, --level string       log level to filter for. (verbose, debug, info, warn, error)
  -p, --pid string         pid of process to filter logs for
  -t, --tags stringArray   list of tags to filter device logs for (usage: -t Tag1 -t Tag2 etc.)

Variants

mason xray -d [DEVICEID] logcat
mason xray -d [DEVICEID] logcat [ARGUMENTS]

mason xray describe-log-buffers

The xray describe-log-buffers command gives more detailed information about a specific log buffer on the device, such as size, entries, and the chattiest PIDs (process ids).

this command requires an API Key with the permission XRAY:ADMIN to be configured in the Mason CLI. Visit our guide for configuring an API Key with the Mason CLI if you need help with this.

In order for mason xray describe-log-buffers to succeed, you must supply a deviceId, and (optionally) a log buffer.

Arguments

  -b, --buffer string      log buffer on remote device to describe (main, system, crash, etc.)

Variants

mason xray -d [DEVICEID] describe-log-buffers
mason xray -d [DEVICEID] describe-log-buffers [ARGUMENTS]

mason xray get-logs

The xray get-logs command gives you the current output of a specific log buffer on the device. This does not perform a stream of the logs, to do this, see the mason xray logcat command.

this command requires an API Key with the permission XRAY:ADMIN to be configured in the Mason CLI. Visit our guide for configuring an API Key with the Mason CLI if you need help with this.

In order for mason xray get-logs to succeed, you must supply a deviceId, and (optionally) any additional arguments.

Arguments

  -b, --buffer string      log buffer on remote device to describe (main, system, crash, etc.)
  -c, --count int          number of log entries to retrieve (default -1)
  -h, --help               help for get-logs
  -l, --level string       log level to filter for. (verbose, debug, info, warn, error)
  -p, --pid int            pid of process to filter logs for (default -1)
  -s, --startTime string   starting date time to filter logs for (in device's time) accepted formats: 'MM-dd HH:mm:ss.SSS' and 'yyyy-MM-dd HH:mm:ss.SSS'
  -t, --tags stringArray   list of tags to filter device logs for (usage: -t Tag1 -t Tag2 etc.)

Variants

mason xray -d [DEVICEID] get-logs
mason xray -d [DEVICEID] get-logs [ARGUMENTS]

mason xray get-bug-report

The mason xray get-bug-report command captures a bug report from the device and saves the file to your current directory.

this command requires an API Key with the permission XRAY:ADMIN to be configured in the Mason CLI. Visit our guide for configuring an API Key with the Mason CLI if you need help with this.

In order for a screencap to succeed, you must supply a deviceId, and (optionally) and output path for the file.

Variants

mason xray get-bug-report -d [DEVICEID]
mason xray get-bug-report -d [DEVICEID] -o [OUTPUT_FILEPATH]

mason xray list-files

The xray list-files command lists the files at the specified path on the device.

this command requires an API Key with the permission XRAY:ADMIN to be configured in the Mason CLI. Visit our guide for configuring an API Key with the Mason CLI if you need help with this.

In order for mason xray list-files to succeed, you must supply a deviceId, and a filepath to list.

Variants

mason xray list-files -p [FILEPATH] -d [DEVICEID]

mason xray get-file

The xray get-file command will download the file at the specified path from the device.

this command requires an API Key with the permission XRAY:ADMIN to be configured in the Mason CLI. Visit our guide for configuring an API Key with the Mason CLI if you need help with this.

In order for mason xray get-file to succeed, you must supply a deviceId, and a filepath.

Variants

mason xray get-file -p [FILEPATH] -d [DEVICEID]
mason xray get-file -p [FILEPATH] -d [DEVICEID] -o [OUTPUT_FILEPATH]

mason xray put-file

The xray put-file command will upload the given file to the device at the specified path.

this command requires an API Key with the permission XRAY:ADMIN to be configured in the Mason CLI. Visit our guide for configuring an API Key with the Mason CLI if you need help with this.

In order for mason xray put-file to succeed, you must supply a deviceId, a local filepath of the file you want to put, and a path of the file path on the remote device.

Arguments

  -f, --filePath string   local path of file to put on remote device
  -p, --path string       file path on remote device

Variants

mason xray put-file -f [LOCAL_FILEPATH] -p [FILEPATH] -d [DEVICEID]
mason xray put-file -f [LOCAL_FILEPATH] -p [FILEPATH] -d [DEVICEID] -o [OUTPUT_FILEPATH]

mason xray delete-file

The xray delete-file command will delete the file at the specified path from the device.

this command requires an API Key with the permission XRAY:ADMIN to be configured in the Mason CLI. Visit our guide for configuring an API Key with the Mason CLI if you need help with this.

In order for mason xray delete-file to succeed, you must supply a deviceId, and a filepath.

Variants

mason xray delete-file -p [FILEPATH] -d [DEVICEID]

mason xray install-apk

The xray install-apk command installs an APK on a device.

this command requires an API Key with the permission XRAY:ADMIN to be configured in the Mason CLI. Visit our guide for configuring an API Key with the Mason CLI if you need help with this.

In order for mason xray install-apk to succeed, you must supply a deviceId, an apk to install, and (optionally) any additional arguments.

Arguments

  -t, --allowTestApk              allow the install of test apks. Default: false
  -v, --allowVersionDowngrade     allow a version downgrade for the apk. Default: false
  -f, --filePath string           local path of file to put on remote device
  -g, --grantRuntimePermissions   grant all permissions listed in the app manifest. Default: false
  -h, --help                      help for install-apk
  -r, --reinstall                 reinstall the apk if already present, keeping all of its data. Default: false

Variants

mason xray install-apk -f [APK] -d [DEVICEID]
mason xray install-apk -f [APK] -d [DEVICEID] [ARGUMENTS]

mason xray uninstall-apk

The xray uninstall-apk command uninstalls an APK on a device.

this command requires an API Key with the permission XRAY:ADMIN to be configured in the Mason CLI. Visit our guide for configuring an API Key with the Mason CLI if you need help with this.

In order for mason xray uninstall-apk to succeed, you must supply a deviceId, and an apk to uninstall (this is an apk name)

Variants

mason xray uninstall-apk -a [APKNAME] -d [DEVICEID]

mason xray get-screen-capture

The mason get-screen-capture command captures a screenshot from the device and saves the screenshot to your current directory.

this command requires an API Key with the permission XRAY:ADMIN to be configured in the Mason CLI. Visit our guide for configuring an API Key with the Mason CLI if you need help with this.

In order for a screencap to succeed, you must supply a deviceId.

you can give the Mason CLI a name for the screenshot using -o [NAME]

Variants

mason xray get-screen-capture -d [DEVICEID]
mason xray get-screen-capture -d [DEVICEID] -o [NAME]

mason xray adbproxy

The xray adbproxy command provides support for generic adb commands.

this command requires an API Key with the permission XRAY:ADMIN to be configured in the Mason CLI. Visit our guide for configuring an API Key with the Mason CLI if you need help with this.

Once the xray adbproxy command succeeds, you can run adb connect localhost:$PORT to then execute *any- adb commands.

In order for mason xray adbproxy to succeed, you must supply a deviceId.

You can specify a port using the -p [PORT] command

Variants

mason xray adbproxy -d [DEVICEID]
mason xray adbproxy -d [DEVICEID] -p [PORT]

Usage

mason xray adbproxy -d $DEVICE_ID -p 5555
...

adb connect localhost:5555
adb shell
...

Need help?