Flutterをインストールする

October 16, 2022

asdf (バージョン管理) をインストール

brew でインストールする

$ brew install asdf
Possible conflicting files are:
/usr/local/bin/2to3-3.9 -> /usr/local/Cellar/python@3.9/3.9.1/bin/2to3-3.9
/usr/local/bin/idle3.9 -> /usr/local/Cellar/python@3.9/3.9.1/bin/idle3.9
/usr/local/bin/pydoc3.9 -> /usr/local/Cellar/python@3.9/3.9.1/bin/pydoc3.9
/usr/local/bin/python3.9 -> /usr/local/Cellar/python@3.9/3.9.1/bin/python3.9
/usr/local/bin/python3.9-config -> /usr/local/Cellar/python@3.9/3.9.1/bin/python3.9-config
/usr/local/share/man/man1/python3.9.1 -> /usr/local/Cellar/python@3.9/3.9.1/share/man/man1/python3.9.1
/usr/local/lib/pkgconfig/python-3.9-embed.pc -> /usr/local/Cellar/python@3.9/3.9.1/lib/pkgconfig/python-3.9-embed.pc
/usr/local/lib/pkgconfig/python-3.9.pc -> /usr/local/Cellar/python@3.9/3.9.1/lib/pkgconfig/python-3.9.pc
Error: Could not symlink Frameworks/Python.framework/Versions/3.9/Headers
Target /usr/local/Frameworks/Python.framework/Versions/3.9/Headers
is a symlink belonging to python@3.9. You can unlink it:
  brew unlink python@3.9

To force the link and overwrite all conflicting files:
  brew link --overwrite python@3.9

To list all files that would be deleted:
  brew link --overwrite --dry-run python@3.9

なんかエラーが出たので、メッセージの通りにコマンドを実行してみます。

$ brew unlink python@3.9
$ brew link --overwrite python@3.9

再度、インストールします。

$ brew reinstall asdf

パス設定

私は zsh を使っているので、こちらを参考にパスの設定をします。

$ echo -e "\n. $(brew --prefix asdf)/libexec/asdf.sh" >> ${ZDOTDIR:-~}/.zshrc
$ . ~/.zshrc

flutter インストール

plugin を追加

$ asdf plugin add flutter
$ asdf install flutter 3.3.4

グローバルに設定

$ asdf global flutter 3.3.4

参考


SHARE

Profile picture

Written by tamesuu