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?

ターミナルを再起動したらflutterコマンドが使えなくなる問題

Last updated at Posted at 2023-10-28

背景

flutterの環境構築が完了したあとに、ターミナルを再起動するとflutter doctorなどのコマンドが使用できなくなりました。

開発環境

MacBook Pro CPU: intel
macOs: Sonoma14.1

 $ flutter doctor
zsh: command not found: flutter

再起動するまえは、ちゃんとコマンドが通ってたのですが・・・

対策

おそらく再起動したときにflutterのPATHがリセットされてるんだと思います。
そこで、.zshrcファイルに直接PATHを書き込みます。
※ flutterのPATHは人の環境次第で違うと思いますが、私の場合は
/Users/ホームディレクトリのユーザー名/flutter/binですね。

~ $ echo 'export PATH="/Users/ホームディレクトリのユーザー名/flutter/bin:$PATH"' >> ~/.zshrc

これでターミナルを再起動して、もう一度flutter doctorを実行すると

~ $ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.13.9, on macOS 14.1 23B74 darwin-x64, locale ja-JP)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 15.0.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.3)
[✓] IntelliJ IDEA Community Edition (version 2023.1.3)
[✓] VS Code (version 1.83.1)
[✓] Connected device (3 available)
[✓] Network resources

• No issues found!

異常なく起動できました。

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?