tauri-apps / tauri

Build smaller, faster, and more secure desktop applications with a web frontend.
https://tauri.app
Apache License 2.0
81.54k stars 2.44k forks source link

[bug] [alpha] unable to run dev iOS on M1 air #8565

Open Apogeum12 opened 8 months ago

Apogeum12 commented 8 months ago

Describe the bug

euuki_mac@MacBook-Air-Sebastian calculator % npm run tauri ios dev 

> calculator@0.8.1 tauri
> tauri ios dev

        Info Using 192.168.0.164 to access the development server.
xcrun: error: unable to find utility "devicectl", not a developer tool or in PATH
/opt/homebrew/bin/ios-deploy
        Info package `ios-deploy` present: true
       Error Failed to detect connected iOS Simulator devices: Failed to request device list from `simctl`: command ["xcrun", "simctl", "list", "--json", "devices", "available"] exited with code 72
     Running BeforeDevCommand (`bun run dev`)
$ vite

  VITE v5.0.11  ready in 330 ms

  ➜  Local:   http://localhost:1420/
  ➜  Network: *********** <--- I manually hide this part
        Info detected host target triple "aarch64-apple-darwin"
        Info Opening Xcode

Reproduction

Compile project with: bun run tauri ios dev, code available here https://github.com/Apogeum12/calculator/tree/20-alpha-macos-support

Expected behavior

1) Open iPhone simulation Works 2) open app on the phone

Full tauri info output

euuki_mac@MacBook-Air-Sebastian calculator % bun run tauri info    
$ tauri info
WARNING: Only one package manager should be used, but found npm and bun.
         Please remove unused package manager lock files, will use npm for now!

[✔] Environment
    - OS: Mac OS 14.2.1 X64
    ✔ Xcode Command Line Tools: installed
    ✔ rustc: 1.75.0 (82e1608df 2023-12-21)
    ✔ cargo: 1.75.0 (1d8b05cdd 2023-11-20)
    ✔ rustup: 1.26.0 (5af9b9484 2023-04-05)
    ✔ Rust toolchain: stable-aarch64-apple-darwin (default)
    - node: 21.5.0
    - npm: 10.2.4
    - bun: 1.0.21

[-] Packages
    - tauri [RUST]: 2.0.0-alpha.20
    - tauri-build [RUST]: 2.0.0-alpha.13
    - wry [RUST]: 0.35.2
    - tao [RUST]: 0.24.0
    - @tauri-apps/api [NPM]: 2.0.0-alpha.13
    - @tauri-apps/cli [NPM]: 2.0.0-alpha.20

[-] App
    - build-type: bundle
    - CSP: unset
    - distDir: ../dist
    - devPath: http://localhost:1420/
    - framework: SolidJS
    - bundler: Vite

[-] iOS
    - Developer Teams: None

Stack trace

No response

Additional context

tauri.conf.json

{
  "build": {
    "beforeDevCommand": "bun run dev",
    "beforeBuildCommand": "bun run build",
    "devPath": "http://localhost:1420",
    "distDir": "../dist"
  },
  "package": {
    "productName": "calculator",
    "version": "0.8.1"
  },
  "tauri": {
    "bundle": {
      "active": true,
      "android": {
        "minSdkVersion": 24
      },
      "targets": [
        "dmg",
        "app"
      ],
      "copyright": "MIT",
      "shortDescription": "Simple Calculator in Tauri for testing the current status of the framework.",
      "longDescription": "Calculator in Tauri is built in solid.js and Bun. It uses styled-components and Material UI, and it also use the library \"evalexpr\" to calculate formulas.",
      "identifier": "com.sebluc.dev",
      "icon": [
        "icons/32x32.png",
        "icons/128x128.png",
        "icons/128x128@2x.png",
        "icons/icon.icns",
        "icons/icon.ico"
      ],
      "macOS": {
        "minimumSystemVersion": "10.13",
        "license": "MIT"
      },
      "iOS": {
        "developmentTeam": "Sebastian Luc developer"
      }
    },
    "security": {
      "csp": null
    },
    "windows": [
      {
        "fullscreen": false,
        "resizable": true,
        "title": "calculator",
        "width": 360,
        "maxWidth": 700,
        "minWidth": 320,
        "height": 620,
        "maxHeight": 950,
        "minHeight": 590,
        "transparent": false,
        "decorations": false
      }
    ]
  },
  "plugins": {
    "shell": {
      "open": true
    }
  }
}
pewsheen commented 7 months ago

Hi, what's your Xcode version and iOS version of the simulator you have installed?

Apogeum12 commented 7 months ago

Hey @pewsheen Xcode: version 15.2 (15C500b) IOS Simulator: 15.2 (1019) SimulatorKit 937 CoreSimulator 944.5

pewsheen commented 7 months ago

I saw the error message said:

xcrun: error: unable to find utility "devicectl", not a developer tool or in PATH

And that's weird because devicectl should be installed with Xcode 15.

Could you run these commands in the terminal and post the result here? xcrun -f devicectl xcode-select -p

xcrun -f devicectl: to see if devicectl is installed with Xcode command line tool xcode-select -p: see if Xcode command line tool points to Xcode 15. Sometimes it points to old version or beta version..

Apogeum12 commented 7 months ago

@pewsheen

So it's my output on Mac. Maybe it's missing some steps for prerequisites on the https://beta.tauri.app/guides/prerequisites/ ?

pewsheen commented 7 months ago

Hmm.. xcode-select should point to /Applications/Xcode.app/Contents/Developer

Could you try the following command?

sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
xcrun -f devicectl

Let's see if it can find devicectl now. If it exist, then run npm run tauri ios dev again.

Apogeum12 commented 7 months ago

@pewsheen

$ xcrun -f devicectl
/Applications/Xcode.app/Contents/Developer/usr/bin/devicectl

for command to run iOS dev by bun:

$ bun run tauri ios dev
$ tauri ios dev
        Info Using 192.168.0.164 to access the development server.
/opt/homebrew/bin/ios-deploy
        Info package `ios-deploy` present: true
Detected iOS simulators:
  [0] iPad (10th generation)
  [1] iPad (9th generation)
  [2] iPad Air (5th generation)
  [3] iPad Air (5th generation)
  [4] iPad Pro (11-inch) (3rd generation)
  [5] iPad Pro (11-inch) (4th generation)
  [6] iPad Pro (12.9-inch) (5th generation)
  [7] iPad Pro (12.9-inch) (6th generation)
  [8] iPad mini (6th generation)
  [9] iPad mini (6th generation)
  [10] iPhone 14
  [11] iPhone 14 Plus
  [12] iPhone 14 Pro
  [13] iPhone 14 Pro Max
  [14] iPhone 15
  [15] iPhone 15 Plus
  [16] iPhone 15 Pro
  [17] iPhone 15 Pro Max
  [18] iPhone SE (3rd generation)
  [19] iPhone SE (3rd generation)
  Enter an index for a simulator above.
Simulator: 17
        Info Starting simulator iPhone 15 Pro Max
     Running BeforeDevCommand (`bun run dev`)
        Warn Invalid target triple: aarch64-apple-ios-sim
$ vite

  VITE v5.0.11  ready in 653 ms

  ➜  Local:   http://localhost:1420/
        Warn Waiting for your frontend dev server to start on http://192.168.0.164:1420/...
        Warn Waiting for your frontend dev server to start on http://192.168.0.164:1420/...
        Warn Waiting for your frontend dev server to start on http://192.168.0.164:1420/...
        Warn Waiting for your frontend dev server to start on http://192.168.0.164:1420/...
        Warn Waiting for your frontend dev server to start on http://192.168.0.164:1420/...
        Warn Waiting for your frontend dev server to start on http://192.168.0.164:1420/...
        Warn Waiting for your frontend dev server to start on http://192.168.0.164:1420/...
        Warn Waiting for your frontend dev server to start on http://192.168.0.164:1420/...
        Warn Waiting for your frontend dev server to start on http://192.168.0.164:1420/...
        Warn Waiting for your frontend dev server to start on http://192.168.0.164:1420/...
        Warn Waiting for your frontend dev server to start on http://192.168.0.164:1420/...
        Warn Waiting for your frontend dev server to start on http://192.168.0.164:1420/...
        Warn Waiting for your frontend dev server to start on http://192.168.0.164:1420/...
        Warn Waiting for your frontend dev server to start on http://192.168.0.164:1420/...
        Warn Waiting for your frontend dev server to start on http://192.168.0.164:1420/...
        Warn Waiting for your frontend dev server to start on http://192.168.0.164:1420/...
        Warn Waiting for your frontend dev server to start on http://192.168.0.164:1420/...
^[[B^[[B        Warn Waiting for your frontend dev server to start on http://192.168.0.164:1420/...
^C

None errors, and simulation it open, but It can't connect with frontend, I check and in safari http://localhost:1420/ works but http://192.168.0.164:1420/ don't work. But in my opinion it's a progress, now find devicectl.

pewsheen commented 7 months ago

Should be the same as this: https://discord.com/channels/616186924390023171/1195345548476170301/1195362095621996616

Try running cargo update inside src-tauri folder and also update @tauri-apps/cli. Make sure your tauri [RUST] and @tauri-apps/cli [NPM] update to version 2.0.0-alpha.21.