Skip to content

Instantly share code, notes, and snippets.

@wcoder
Last active July 14, 2021 15:33
Show Gist options
  • Save wcoder/6f6a876056d96ca615abd46542088d79 to your computer and use it in GitHub Desktop.
Save wcoder/6f6a876056d96ca615abd46542088d79 to your computer and use it in GitHub Desktop.
DEVICE_NAME="iPhone 11"
APP_BUNDLE_ID="com.softeq.Playground-iOS"
# Device ID
DEVICE_UDID=$(xcrun simctl list devices iphone available | grep "${DEVICE_NAME} (" | sed -e 's/^.*(\(.*\)) (.*$/\1/')
echo "DEVICE_ID=${DEVICE_UDID}"
# Boot device
xcrun simctl boot $DEVICE_UDID
# Launch app
xcrun simctl launch --console $DEVICE_UDID $APP_BUNDLE_ID
# App Path
APP_CONTAINER_PATH=$(xcrun simctl get_app_container $DEVICE_UDID $APP_BUNDLE_ID)
echo "APP_CONTAINER_PATH=${APP_CONTAINER_PATH}"
# App ID
APP_CONTAINER_ID=$(echo $APP_CONTAINER_PATH | sed -e 's/^.*Application\/\(.*\)\/.*$/\1/')
echo "APP_CONTAINER_ID=${APP_CONTAINER_ID}"
# ...
# Shutdown all devices
xcrun simctl shutdown all
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment