Check Your Flutter Installation with Flutter Doctor
Introduction
Flutter development environments often require additional tooling, mainly when we write, run, and debug code on multiple platforms. Setting it all up can get complicated.
Flutter Doctor was created to help developers set up their environment. It diagnoses the developer’s computer to ensure we’ve installed Flutter and it is ready to use.
We can run Flutter Doctor anytime we update or change our system configuration to ensure Flutter continues to be set up correctly.
What can the Flutter Doctor Do?
The Flutter Doctor performs the following tasks:
- Downloads missing files required by the development environment.
- Ensures we’ve installed the following:
- Android SDK
- Apple Xcode (on Mac)
- Ensures that we’ve agreed to all software development licenses.
- Checks the Android Studio IDE setup and recommends any changes required to get it working with Flutter.
- Checks for connected devices.
- Verifies that Flutter can recognize any connected hardware devices.
- Recommends any changes required to get them connected and working.
- Outputs a diagnosis, listing out issues found and recommendations.
Running Flutter Doctor on Mac Terminal
We can run Flutter Doctor on a Mac using the built-in Terminal application. We can open the Terminal by:
- Opening
Spotlight Search
by pressing the Command and Space buttons at the same time. - In
Spotlight Search
, we can then open aTerminal
and hit the Return key.
Once we have the Terminal open, we can type the following and hit enter:
flutter doctor -v
We should now see the output of Flutter Doctor in the Terminal.
Running Flutter Doctor in Windows Command Prompt
We can run Flutter Doctor on a PC by using the command prompt. We can open the command prompt by:
- Clicking on the Windows Start button.
- Typing in
command prompt
and pressing Enter.
Once we have the command prompt open, we can type the following and hit enter:
flutter doctor -v
Flutter Doctor will display its output in the command prompt window.
Flutter Doctor Output
When run, Flutter Doctor outputs a report of your Flutter setup’s “health.” Let’s look at an example output and how Flutter Doctor helps us to fix the issues.
In this example, Flutter Doctor has found two issues with our setup.
First, we need to accept the Android licenses. Flutter Doctor tells us to run
flutter doctor --android-licenses
to resolve the issue.Second, Flutter Doctor indicates we do not have Xcode installed. We can resolve this by following the directions and installing Xcode, running the necessary commands, and installing CocoaPods (a packaging system used in iOS and macOS app development).
We might not see this output on our device; we could see different or no issues. Regardless, Flutter Doctor will provide directions on solving any problems found in our setup.
Once we have resolved our issues, we can then develop Flutter applications!
Here is an example of a Flutter development environment that is set up and has no issues.
Review
Congratulations! Let’s review what we learned about the Flutter Doctor:
- Flutter Doctor checks everything is installed and configured in our Flutter setup
- When there is an issue, Flutter Doctor will recommend steps for fixing it
- We should run Flutter Doctor when we first install or when we update our system
Now that we have checked our setup, we are ready to create our first project!
Author
'The Codecademy Team, composed of experienced educators and tech experts, is dedicated to making tech skills accessible to all. We empower learners worldwide with expert-reviewed content that develops and enhances the technical skills needed to advance and succeed in their careers.'
Meet the full team