---
schema_version: "1"
id: 5e46383c6d812b57016d2e5e91fc1802579a696db377f88d502bd575e9735f23
title: doctor
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/salesforcedx/sfclireference/guides/doctor/cli_reference_doctor_command.md
canonical_url: https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference_doctor_command.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 9ba37b5826cabf8bca39d186bd6454e51d9990da578040ef464048a01e8c9c7d
products:
  - Salesforce CLI Command Reference
  - salesforcedx
---
<!-- prettier-ignore-start -->

# doctor

Gather CLI configuration data and run diagnostic tests to discover and report potential problems in your environment.

## Description for doctor

When you run the doctor command without parameters, it first displays a diagnostic overview of your environment. It then writes a detailed diagnosis to a JSON file in the current directory. Use the --outputdir to specify a different directory. To run diagnostic tests on a specific plugin, use the --plugin parameter. If the plugin isn't listening to the doctor, then you get a warning.

Use the --command parameter to run a specific command in debug mode; the doctor writes both stdout and stderr to \*.log files that you can provide to Salesforce Customer Support or attach to a GitHub issue.

Plugin providers can also implement their own doctor diagnostic tests by listening to the "sf-doctor" event and running plugin specific tests that are then included in the doctor diagnostics log.

## Flags

| Flag Name (Long) | Flag Name (Short) | Description |
|------------------|-------------------|-------------|
| <code>&#8209;&#8209;command</code> | <code>&#8209;c</code> | **Type:** Value<br><br>Command to run in debug mode; results are written to a log file. |
| <code>&#8209;&#8209;create&#8209;issue</code> | <code>&#8209;i</code> | **Type:** Boolean<br><br>Create a new issue on our GitHub repo and attach all diagnostic results. |
| <code>&#8209;&#8209;flags&#8209;dir</code> | N/A | **Type:** Value<br><br>Import flag values from a directory. |
| <code>&#8209;&#8209;json</code> | N/A | **Type:** Boolean<br><br>Format output as json. |
| <code>&#8209;&#8209;output&#8209;dir</code> | <code>&#8209;d</code> | **Type:** Value<br><br>Directory to save all created files rather than the current working directory. |
| <code>&#8209;&#8209;plugin</code> | <code>&#8209;p</code> | **Type:** Value<br><br>Specific plugin on which to run diagnostics. |

## Examples for doctor

Run CLI doctor diagnostics:

```shell
sf doctor
```

Run CLI doctor diagnostics and the specified command, and write the debug output to a file:

```shell
sf doctor --command "force:org:list --all"
```

Run CLI doctor diagnostics for a specific plugin:

```shell
sf doctor --plugin @salesforce/plugin-source
```
<!-- prettier-ignore-end -->
