skip to Main Content

These commands were used to run multiple simulators, install Expo, and run the app. This was working fine before Xcode 13, and after installing Xcode 13, it doesn’t load simulators anymore as it can not find "instruments" anymore.

Any idea?

#!/bin/bash
declare -a simulators=("0FAE2F92-9EF7-4C4A-8F9D-097A056F8CC0" "BFCDD662-E4DE-4C08-9DF6-CAACA7C00CEC" "1A6959A0-C10F-474B-96C5-7E8955FBDD80")

for i in "${simulators[@]}"
do
    xcrun instruments -w $i
    xcrun simctl install $i ~/.expo/ios-simulator-app-cache/Exponent-2.19.6.tar.app
    xcrun simctl openurl $i exp://127.0.0.1:19000      
done

2

Answers


  1. Chosen as BEST ANSWER

    Those who need to run multiple simulators with one command, please follow this instruction. Since "instruments" is not available on Xcode 13 anymore, you need an equivalent command to boot simulators.

    Replace the device IDs with your device IDs xcrun simctl list. Also, replace the Expo version with what you have on your machine.

    #!/bin/zsh
    declare -a simulators=("27D6B718-8348-4C4D-ADFC-6506C2A88EED" "531A59B8-6197-4620-904B-E55308D1EE96" "C08532FE-3CE4-4BB7-A04C-795F2FA7EFE1")
    echo "STARTED"
    open -a Simulator
    wait_time=1
    for i in $simulators[@]
    do
        echo "Boot $i"
        xcrun simctl boot $i
        sleep $wait_time
        echo "Install Expo $i"
        xcrun simctl install $i ~/.expo/ios-simulator-app-cache/Exponent-2.19.6.tar.app
        sleep $wait_time
        echo "Lauch Expo $i"
        xcrun simctl openurl $i exp://127.0.0.1:19000
        sleep $wait_time
    done
    echo "FINISHED"
    

  2. The solution that Fred A proposed works. "xcrun simctl" boot command can replace the instruments command to start the simulator. I can’t find the exact xctrace command that replace the instruments -w command in those multiple simulators example, until finding some clue in this post. Thanks Fred A!

    Below is the script I modified to start multiple simulators in Xcode 13.

    
    # installs and lanches the `bundle_id` for the specified simulator device
    ### bin/sh
    
    # please put the simulators UUID in this array
    
    simulators=("B75B9F28-AE93-4B06-8110-AD284CB1DDB7" "A3101107-6605-4E92-A45B-20E3DDF25E37" )
    
    # please put the app_location here
    
    app_location_path="~/Library/Developer/Xcode/DerivedData/XXXXX-cswzhnrhthwoqzdptzdcosamizis/Build/Products/Debug-iphonesimulator"
    app_name="XXXXXX.app"
    bundle_id="XXXXX"
    
    
    for i in ${simulators[@]}
    do
            echo "xcrun simctl boot "$i""
            xcrun simctl boot "$i" &
            echo "xcrun simctl install "$i" $app_location_path/$app_name"
            xcrun simctl install "$i" $app_location_path/$app_anme &
            echo "xcrun simctl launch "$i" "$bundle_id""
            xcrun simctl launch "$i" "$bundle_id" &
    done
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search