---
tags: flutter,
disqus: hackmd
---
# 安裝Flutter
### Mac OS
第一步:下載SDK
到[這裡](https://flutter.axuer.com/docs/get-started/install/macos)去下載SDK包並解壓縮到你的資料夾

第二步:設定路徑
> $ export PATH="$PATH:`pwd`/flutter/bin"
根據官網解釋,此命令僅將PATH變量設置為當前終端窗口。
### 設定永久Flutter路徑
可以看[update-your-path](https://flutter.axuer.com/docs/get-started/install/macos#update-your-path)
先打開你的`.bash_profile`檔
> vim .bash_profile
其中 [PATH_TO_FLUTTER_GIT_DIRECTORY] 就是你存放flutter sdk包的路徑位置
> $ export PATH="$PATH:[PATH_TO_FLUTTER_GIT_DIRECTORY]/flutter/bin"
再打開terminal運行`source $HOME/.bash_profile`以刷新當前窗口。
要記得刷新。
```
//查看flutter的版本
flutter --version
//查看開發flutter需要的環境
flutter doctor
```
這裡要提醒一下,如果你是用`Z shell`的話就是改`.zshrc`不是改`.bash_profile`,然後設定路徑就可以。
[zsh: command not found: flutter - macOS](https://github.com/flutter/flutter/issues/40140)
---
輸入flutter doctor後,你可能會看到類似這樣的畫面
這是doctor幫你診斷後給的診對書,只要把上面列表的都弄成`綠色勾勾`就可以了

---
如果你的android studio已經確認有安裝Flutter跟Dart的plugin
但是doctor診斷還是有錯的話,那可以在terminal輸入下面這段指令
> ln -s ~/Library/Application\ Support/Google/AndroidStudio4.1/plugins ~/Library/Application\ Support/AndroidStudio4.1
---
[影片安裝教學1](https://www.youtube.com/watch?v=hL7pkX1Pfko)
[影片安裝教學2](https://www.youtube.com/watch?v=gv1LScpG0jM)
[影片安裝教學3 - android環境](https://www.youtube.com/watch?v=_p3VbxiVuRU)
[影片安裝教學4 - ios環境](https://www.youtube.com/watch?v=3oIFshgMgLA)
[影片安裝教學5 - ios環境2](https://www.youtube.com/watch?v=H_xusHxICbk)
---
參考文章
[Flutter 環境建置 (Windows)](https://titangene.github.io/article/flutter-install-on-windows.html)