sharkdp/fd · error · anyhow::Error

'fd --list-details' is not supported on Windows unless GNU…

Error message

'fd --list-details' is not supported on Windows unless GNU 'ls' is installed.

What it means

--list-details shells out to an external `ls` to produce a long-format listing. On Windows there is no compatible native ls, so fd probes for GNU ls (`ls --version`) and falls back to this error (main.rs:484) when it is absent. Only Windows reaches this branch.

Solutions

  1. Install GNU coreutils on Windows (e.g., via scoop install coreutils, chocolatey, or Git for Windows which bundles GNU ls).
  2. Ensure GNU ls is on PATH: `where ls` should resolve to a GNU binary.
  3. Drop --list-details if a long listing is not required: `fd <pattern>`.

Example fix

# before (Windows, no GNU ls)
fd --list-details

# after (install GNU coreutils, ensure on PATH)
scoop install coreutils
fd --list-details
Defensive patterns

Strategy: validation

Validate before calling

if ls --version >/dev/null 2>&1; then
  fd --list-details
else
  echo "GNU ls required on Windows for --list-details" >&2; exit 1
fi

Prevention

When it happens

Trigger: Running `fd --list-details` on Windows without GNU coreutils installed. The Command::new("ls").arg("--version").status() check returns Err or the binary is missing.

Common situations: Vanilla Windows installs lacking Git-Bash/MSYS2/WLS; systems where ls is the PowerShell alias rather than GNU ls; fresh Windows machines.

Related errors


AI-assisted analysis of sharkdp/fd@ee20f426dd (2026-08-09). Data as JSON: /api/errors/52d4b4e992fc9b42. Report an issue: GitHub.

Appendix: source

Thrown at src/main.rs:484

                cmd
            }
        }
    } else if cfg!(windows) {
        use std::process::{Command, Stdio};

        // Use GNU ls, if available
        let gnu_ls_exists = Command::new("ls")
            .arg("--version")
            .stdout(Stdio::null())
            .stderr(Stdio::null())
            .status()
            .is_ok();

        if gnu_ls_exists {
            gnu_ls("ls")
        } else {
            return Err(anyhow!(
                "'fd --list-details' is not supported on Windows unless GNU 'ls' is installed."
            ));
        }
    } else {
        return Err(anyhow!(
            "'fd --list-details' is not supported on this platform."
        ));
    };
    Ok(cmd)
}

fn extract_time_constraints(opts: &Opts) -> Result<Vec<TimeFilter>> {
    let mut time_constraints: Vec<TimeFilter> = Vec::new();
    if let Some(ref t) = opts.changed_within {
        if let Some(f) = TimeFilter::after(t) {
            time_constraints.push(f);
        } else {
            return Err(anyhow!(

View on GitHub (pinned to ee20f426dd)