0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Intel MacでFlutterインストール後にiOSエミュレーターが起動できなかった問題と解決策

Posted at

概要:問題と解決策

問題

  • macOS(Intel)環境でFlutterとXcodeをインストール後
  • iOSエミュレーターが起動できない
  • エラーメッセージ:Failed to launch iOS Simulator: Error: Emulator didn't connect within 60 seconds

原因

  • CocoaPodsがインストールされていない
  • Xcodeの必要なiOSシミュレーターコンポーネントが未インストール

解決策

  1. CocoaPodsをインストール:brew install cocoapods
  2. Xcodeを開き「Settings」→「Components」から必要なiOSコンポーネントをダウンロード

環境構築の手順

以下の手順で環境構築しました

  1. Flutter SDKのインストール(macOS Intel環境)
  2. VSCodeへのFlutter拡張機能のインストール
  3. Xcodeのインストール(iOS開発に必須)

問題発生の状況

VSCodeでの作業手順:

  1. Flutterの拡張機能をインストール済みの状態
  2. コマンドパレット(Cmd+Shift+P)から「flutter: New Project」を選択してプロジェクトを作成
  3. 再びコマンドパレットから「flutter: Select Device」を選択
  4. 「Start iOS Simulator」を選択

発生したエラー

Failed to launch iOS Simulator: Error: Emulator didn't connect within 60 seconds

原因の調査

何が問題なのかを確認するため、ターミナルでflutter doctorコマンドを実行しました。

[!] Xcode - develop for iOS and macOS (Xcode 16.3)
    ✗ Unable to get list of installed Simulator runtimes.
    ✗ CocoaPods not installed.
        CocoaPods is a package manager for iOS or macOS platform code.
        Without CocoaPods, plugins will not work on iOS or macOS.
        For more info, see https://flutter.dev/to/platform-plugins
      For installation instructions, see https://guides.cocoapods.org/using/getting-started.html#installation

診断結果から2つの問題が確認できました:

  1. シミュレーターランタイムのリストが取得できない
  2. CocoaPods(iOSプラグイン用のパッケージマネージャー)がインストールされていない

解決策

1. CocoaPodsのインストール

まず、Homebrewを使用してCocoaPodsをインストールしました:

brew install cocoapods

インストール後、再度flutter doctorを実行しましたが、まだ問題が残っていました:

[!] Xcode - develop for iOS and macOS (Xcode 16.3) [1,104ms]
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 16E140
    ✗ Unable to get list of installed Simulator runtimes.
    • CocoaPods version 1.16.2

2. iOSシミュレーターコンポーネントのインストール

CocoaPodsをインストールしても問題が解決しなかったため、Xcodeの設定を確認しました。

Xcodeを開き、「Settings」→「Components」を確認したところ、iOSのコンポーネント(シミュレーター)がダウンロードされていないことが判明しました。

必要なiOSコンポーネントをダウンロードしてインストールした後、再度iOSシミュレーターの起動を試みたところ、正常に起動できるようになりました。

まとめと反省

最初に実行したflutter doctorコマンドをよく読まず、ブラウザでの確認が済んだので「最低限の状況は整った!」と作業を進めていました。
iOSの確認してみよーと試してみたらエラーが出て、flutter doctorコマンドを実行せず「なぜ?」が先行し、時間を浪費しました。

次回からは診断コマンドを先に実行し、エラーメッセージをしっかり読んで対応します。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?