tauri icon indicating copy to clipboard operation
tauri copied to clipboard

[bug] tauri ios init fails on M1 mac

Open szmarci opened this issue 1 year ago • 2 comments

Describe the bug

After installing prerequisites, running bun run tauri ios init, results in:

$ tauri ios init
    Warn No code signing certificates found. You must add one and set the certificate development team ID on the `bundle > iOS > developmentTeam` config value or the `APPLE_DEVELOPMENT_TEAM` environment variable. To list the available certificates, run `tauri info`.
    Info detected rustc version 1.81.0 (eeb90cda1 2024-9-4)
/usr/local/bin/xcodegen
    Info package `xcodegen` present: true
/opt/local/bin/idevicesyslog
    Info package `libimobiledevice` present: true
/usr/local/bin/pod
    Info package `cocoapods` present: true
failed to install Apple dependencies: Failed to check for outdated packages: No such file or directory (os error 2): No such file or directory (os error 2)
    Error failed to install Apple dependencies: Failed to check for outdated packages: No such file or directory (os error 2): No such file or directory (os error 2)
error: script "tauri" exited with code 1

Reproduction

No response

Expected behavior

No response

Full tauri info output

[✔] Environment
    - OS: Mac OS 15.0.0 arm64 (X64)
    ✔ Xcode Command Line Tools: installed
    ✔ rustc: 1.81.0 (eeb90cda1 2024-09-04)
    ✔ cargo: 1.81.0 (2dbb1af80 2024-08-20)
    ✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
    ✔ Rust toolchain: stable-aarch64-apple-darwin (default)
    - node: 18.18.2
    - pnpm: 9.6.0
    - npm: 9.8.1
    - bun: 1.1.29

[-] Packages
    - tauri 🦀: 2.0.0
    - tauri-build 🦀: No version detected
    - wry 🦀: No version detected
    - tao 🦀: No version detected
    - @tauri-apps/api : 2.0.1
    - @tauri-apps/cli : 2.0.1

[-] Plugins
    - tauri-plugin-shell 🦀: 2.0.0
    - @tauri-apps/plugin-shell : 2.0.0

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../dist
    - devUrl: http://localhost:1420/
    - framework: React
    - bundler: Vite

Stack trace

No response

Additional context

No response

szmarci avatar Oct 06 '24 18:10 szmarci

Just encountered this exact issue several times, you just need to rerun tauri ios init and wait the cocoapods package updating some Apple dependencies.

chrox avatar Oct 11 '24 17:10 chrox

In case of any misconfigurations, please ensure that you follow the prerequisites for iOS.

chrox avatar Oct 11 '24 17:10 chrox

I did follow the guide, but every time I run tauri ios init, I get back the original error:

Info package `cocoapods` present: true
failed to install Apple dependencies: Failed to check for outdated packages: No such file or directory (os error 2): No such file or directory (os error 2)
    Error failed to install Apple dependencies: Failed to check for outdated packages: No such file or directory (os error 2): No such file or directory (os error 2)
error: script "tauri" exited with code 1

I'm not sure if it makes a difference but I don't have homebrew installed, I have cocoapods installed with sudo gem install cocoapods

szmarci avatar Oct 24 '24 15:10 szmarci

Restarting your mac may resolve the issue

nongyehong avatar Oct 30 '24 06:10 nongyehong

Looking at the code this error happens either if gem outdated failed or brew outdated --json=v2 failed. Ensure that both of these commands are present on your machine.

zaynetro avatar Dec 21 '24 08:12 zaynetro

I don't have homebrew installed, I installed dependencies manually or via macports. I can't use homebrew, but according to the docs it is only used for installing cocoapods, which I installed via gem. I also updated all packages via gem outdated. Nothing changed, I still get this error.

szmarci avatar Dec 26 '24 09:12 szmarci

You don't need to install homebrew. I personally have put this script in my PATH:

#/usr/bin/env bash

set -e

cmd="$1"
if [[ "$cmd" == "outdated" ]]; then
  # npm run tauri ios init  runs  brew outdated --json=v2
  echo "{ \"formulae\": [] }"
  exit 0
fi

echo "-------------------------------"
echo "brew was called with args:"
echo "$@"
echo "-------------------------------"

I agree that it is annoying that homebrew is "secretly" used when running the project.

zaynetro avatar Dec 26 '24 10:12 zaynetro

@zaynetro Thank you very much, I finally got it working with your script. I never would have thought they are using it like that...

szmarci avatar Dec 27 '24 19:12 szmarci