简体   繁体   中英

MacOS gives zsh: command not found: flutter after updating path according to Flutter

Recently I updated Mac OS to latest Catalina and my terminal which is using zsh now start showing me following error:

zsh: command not found: flutter

It was working fine before update

First of all, I suggest using FVM (Flutter Version Management). Which is a great tool, that can be used to install and switch between Flutter versions easily.

https://fvm.app

Concerning zsh, you could create a file named ~/.zshenv where you can configure path variables. It works a bit differently than with bash.

#!/bin/zsh

# makes path an array with unique elements
typeset -U path

# adds flutter to the path
path+=('/Users/XXX/Tools/FVM/default/bin')

# adds global dart packages to the path
path+=('/Users/XXX/.pub-cache/bin')

export PATH

As you can see, I use Flutter with FVM, but you can of course just download Flutter yourself and provide the path in the .zshenv file. After changing the file you may want to run source ~/.zshenv , to make the changes available in the running terminal session.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM