-
Notifications
You must be signed in to change notification settings - Fork 401
Description
Update (2025-09-23):
It turns out the issue was related to the region settings. I had English (US) as the primary language with the region set to Japan. After changing the region to the United States, the problem was resolved. Switching it back to Japan reproduced the issue.
Describe the bug
Each time I start a new bash session, the following warning is prompted:
-bash: warning: setlocale: LC_COLLATE: cannot change locale (): No such file or directory
-bash: warning: setlocale: LC_COLLATE: cannot change locale (): No such file or directory
After debugging it using PS4='+ $BASH_SOURCE:$LINENO:' bash -xlic ""
, I found the issues are related to bash-completion@2
in the output:
+++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:372:(( 5 ))
bash: warning: setlocale: LC_COLLATE: cannot change locale (): No such file or directory
+++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:372:(( 1 ))
bash: warning: setlocale: LC_COLLATE: cannot change locale (): No such file or directory
More detailed log
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:3439:for compat_dir in "${compat_dirs[@]}"
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:3440:[[ -d /opt/homebrew/etc/bash_completion.d ]]
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:3440:[[ -r /opt/homebrew/etc/bash_completion.d ]]
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:3440:[[ -x /opt/homebrew/etc/bash_completion.d ]]
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:3441:local compat_files
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:3442:_comp_expand_glob compat_files '"$compat_dir"/*'
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:334:(( 2 != 2 ))
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:338:[[ compat_files == @(GLOBIGNORE|GLOBSORT|_*|*[^_a-zA-Z0-9]*|[0-9]*|) ]]
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:344:local _original_opts=braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor:xtrace:checkwinsize:cmdhist:complete_fullquote:expand_aliases:extglob:extquote:force_fignore:globasciiranges:globskipdots:interactive_comments:login_shell:patsub_replacement:progcomp:promptvars:sourcepath
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:345:set +o noglob
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:346:shopt -s nullglob
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:347:shopt -u failglob dotglob
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:351:local GLOBIGNORE= GLOBSORT=name
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:355:local LC_COLLATE=C LC_CTYPE=en_US.UTF-8 LC_ALL=
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:357:eval -- 'compat_files=()'
+++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:357:compat_files=()
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:358:eval -- 'compat_files=("$compat_dir"/*)'
+++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:358:compat_files=("$compat_dir"/*)
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:363:_comp_unlocal GLOBIGNORE
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:251:(( BASH_VERSINFO[0] >= 5 ))
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:251:shopt -q localvar_unset
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:256:unset -v GLOBIGNORE
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:364:[[ :braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor:xtrace:checkwinsize:cmdhist:complete_fullquote:expand_aliases:extglob:extquote:force_fignore:globasciiranges:globskipdots:interactive_comments:login_shell:patsub_replacement:progcomp:promptvars:sourcepath: == *:dotglob:* ]]
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:367:shopt -u dotglob
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:369:[[ :braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor:xtrace:checkwinsize:cmdhist:complete_fullquote:expand_aliases:extglob:extquote:force_fignore:globasciiranges:globskipdots:interactive_comments:login_shell:patsub_replacement:progcomp:promptvars:sourcepath: == *:nullglob:* ]]
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:369:shopt -u nullglob
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:370:[[ :braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor:xtrace:checkwinsize:cmdhist:complete_fullquote:expand_aliases:extglob:extquote:force_fignore:globasciiranges:globskipdots:interactive_comments:login_shell:patsub_replacement:progcomp:promptvars:sourcepath: == *:failglob:* ]]
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:371:[[ :braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor:xtrace:checkwinsize:cmdhist:complete_fullquote:expand_aliases:extglob:extquote:force_fignore:globasciiranges:globskipdots:interactive_comments:login_shell:patsub_replacement:progcomp:promptvars:sourcepath: == *:noglob:* ]]
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:372:eval '((${#compat_files[@]}))'
+++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:372:(( 5 ))
bash: warning: setlocale: LC_COLLATE: cannot change locale (): No such file or directory
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:3443:local compat_file
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:3444:for compat_file in "${compat_files[@]}"
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:3446:[[ 000_bash_completion_compat.bash != @(@(#*#|*@(~|.@(bak|orig|rej|swp|@(dpkg|ucf)-*|rpm@(orig|new|save))))|Makefile*|) ]]
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:3446:[[ -f /opt/homebrew/etc/bash_completion.d/000_bash_completion_compat.bash ]]
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:3446:[[ -r /opt/homebrew/etc/bash_completion.d/000_bash_completion_compat.bash ]]
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:3447:_comp__init_startup_configs+=("$compat_file")
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:3444:for compat_file in "${compat_files[@]}"
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:3446:[[ brew != @(@(#*#|*@(~|.@(bak|orig|rej|swp|@(dpkg|ucf)-*|rpm@(orig|new|save))))|Makefile*|) ]]
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:3446:[[ -f /opt/homebrew/etc/bash_completion.d/brew ]]
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:3446:[[ -r /opt/homebrew/etc/bash_completion.d/brew ]]
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:3447:_comp__init_startup_configs+=("$compat_file")
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:3444:for compat_file in "${compat_files[@]}"
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:3446:[[ git-completion.bash != @(@(#*#|*@(~|.@(bak|orig|rej|swp|@(dpkg|ucf)-*|rpm@(orig|new|save))))|Makefile*|) ]]
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:3446:[[ -f /opt/homebrew/etc/bash_completion.d/git-completion.bash ]]
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:3446:[[ -r /opt/homebrew/etc/bash_completion.d/git-completion.bash ]]
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:3447:_comp__init_startup_configs+=("$compat_file")
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:3444:for compat_file in "${compat_files[@]}"
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:3446:[[ git-prompt.sh != @(@(#*#|*@(~|.@(bak|orig|rej|swp|@(dpkg|ucf)-*|rpm@(orig|new|save))))|Makefile*|) ]]
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:3446:[[ -f /opt/homebrew/etc/bash_completion.d/git-prompt.sh ]]
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:3446:[[ -r /opt/homebrew/etc/bash_completion.d/git-prompt.sh ]]
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:3447:_comp__init_startup_configs+=("$compat_file")
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:3444:for compat_file in "${compat_files[@]}"
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:3446:[[ tmux != @(@(#*#|*@(~|.@(bak|orig|rej|swp|@(dpkg|ucf)-*|rpm@(orig|new|save))))|Makefile*|) ]]
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:3446:[[ -f /opt/homebrew/etc/bash_completion.d/tmux ]]
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:3446:[[ -r /opt/homebrew/etc/bash_completion.d/tmux ]]
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:3447:_comp__init_startup_configs+=("$compat_file")
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:3439:for compat_dir in "${compat_dirs[@]}"
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:3440:[[ -d /opt/homebrew/Cellar/bash-completion@2/2.16.0/etc/bash_completion.d ]]
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:3440:[[ -r /opt/homebrew/Cellar/bash-completion@2/2.16.0/etc/bash_completion.d ]]
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:3440:[[ -x /opt/homebrew/Cellar/bash-completion@2/2.16.0/etc/bash_completion.d ]]
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:3441:local compat_files
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:3442:_comp_expand_glob compat_files '"$compat_dir"/*'
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:334:(( 2 != 2 ))
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:338:[[ compat_files == @(GLOBIGNORE|GLOBSORT|_*|*[^_a-zA-Z0-9]*|[0-9]*|) ]]
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:344:local _original_opts=braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor:xtrace:checkwinsize:cmdhist:complete_fullquote:expand_aliases:extglob:extquote:force_fignore:globasciiranges:globskipdots:interactive_comments:login_shell:patsub_replacement:progcomp:promptvars:sourcepath
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:345:set +o noglob
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:346:shopt -s nullglob
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:347:shopt -u failglob dotglob
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:351:local GLOBIGNORE= GLOBSORT=name
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:355:local LC_COLLATE=C LC_CTYPE=en_US.UTF-8 LC_ALL=
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:357:eval -- 'compat_files=()'
+++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:357:compat_files=()
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:358:eval -- 'compat_files=("$compat_dir"/*)'
+++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:358:compat_files=("$compat_dir"/*)
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:363:_comp_unlocal GLOBIGNORE
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:251:(( BASH_VERSINFO[0] >= 5 ))
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:251:shopt -q localvar_unset
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:256:unset -v GLOBIGNORE
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:364:[[ :braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor:xtrace:checkwinsize:cmdhist:complete_fullquote:expand_aliases:extglob:extquote:force_fignore:globasciiranges:globskipdots:interactive_comments:login_shell:patsub_replacement:progcomp:promptvars:sourcepath: == *:dotglob:* ]]
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:367:shopt -u dotglob
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:369:[[ :braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor:xtrace:checkwinsize:cmdhist:complete_fullquote:expand_aliases:extglob:extquote:force_fignore:globasciiranges:globskipdots:interactive_comments:login_shell:patsub_replacement:progcomp:promptvars:sourcepath: == *:nullglob:* ]]
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:369:shopt -u nullglob
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:370:[[ :braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor:xtrace:checkwinsize:cmdhist:complete_fullquote:expand_aliases:extglob:extquote:force_fignore:globasciiranges:globskipdots:interactive_comments:login_shell:patsub_replacement:progcomp:promptvars:sourcepath: == *:failglob:* ]]
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:371:[[ :braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor:xtrace:checkwinsize:cmdhist:complete_fullquote:expand_aliases:extglob:extquote:force_fignore:globasciiranges:globskipdots:interactive_comments:login_shell:patsub_replacement:progcomp:promptvars:sourcepath: == *:noglob:* ]]
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:372:eval '((${#compat_files[@]}))'
+++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:372:(( 1 ))
bash: warning: setlocale: LC_COLLATE: cannot change locale (): No such file or directory
++++ /opt/homebrew/Cellar/bash-completion@2/2.16.0/share/bash-completion/bash_completion:3443:local compat_file
To reproduce
After making the /opt/homebrew/bin/bash
the default shell via chsh -s /opt/homebrew/bin/bash
, just open the Terminal
app installed by default on macOS, then the Bash warning is prompted. The warning will disappear if I uninstall the bash-completion@2
.
Expected behavior
There is no Bash warning every time a new bash session is created.
Versions (please complete the following information)
- Operating system name/distribution and version:
macOS Sonoma 14.8 (Apple M3)
- bash version,
echo "$BASH_VERSION"
:GNU bash, version 5.3.3(1)-release (aarch64-apple-darwin23.6.0)
- bash-completion version,
(IFS=.; echo "${BASH_COMPLETION_VERSINFO[*]}")
:2.16.0
- Homebrew version:
Homebrew 4.6.11
Additional context
I use the default Terminal
app and the Bash installed via Homebrew as the default shell on macOS:
/opt/homebrew/bin/brew install bash bash-completion@2 coreutils findutils gnu-sed grep
Debug trace
See above, More detailed log
.