WindowsmacOSLinux

Where Does ShellCheck Store Its Config?

ShellCheck reads .shellcheckrc from the script's directory upward, then ~/.shellcheckrc, then the XDG config home.

Last updated

ShellCheck hunts for .shellcheckrc (or shellcheckrc without the dot) starting at the script and climbing parents, then falls back to ~/.shellcheckrc and the XDG config dir. Key=value directives inside act as file-wide rules.

Two packaging quirks bite. Snaps cannot see dotfiles, so use the undotted name there. Inside Docker only mounted paths are visible, so a home rc outside the mount silently vanishes.

Where ShellCheck stores this, by platform

Windows
%APPDATA%\shellcheckrc

disable= and source-path directives per project. SHELLCHECK_OPTS env supplies always-on flags. --rcfile pins an exact file; --norc disables discovery.

macOS
~/.shellcheckrc

Project .shellcheckrc wins over ~/.shellcheckrc, which wins over ~/.config/shellcheckrc. First file found is the only one read.

Linux
~/.shellcheckrc

Same order. Snap builds need the undotted shellcheckrc name; Docker runs only see rc files inside mounted paths.

Frequently asked questions

Do project and home .shellcheckrc files merge?

Only the first file found is used, and project files beat home files. A repo .shellcheckrc shadows your ~/.shellcheckrc completely instead of merging with it.

How do I apply the same flags in every editor and hook?

Set SHELLCHECK_OPTS (for example --shell=bash --exclude=SC2016). It prepends to every invocation, which covers editors and hooks that never pass your flags.

Notice an outdated path? Let us know.