There has to be at least one kind of issue after updating to the latest macOS major release. At first, I started noticing that recalling commands (control
+ R
on macOS, Ctrl
+ R
on Linux) stopped working. Next thing, I was receiving the following warning every time I start the Terminal in VSCode:
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LC_ALL = (unset),
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
Prerequisites
- Shell environment
Solution
macOS
Step 1. If using Z shell (zsh) by default, export the following variables in the ~/.zshrc file:
echo "export LC_ALL=en_US.UTF-8" >> ~/.zshrc
echo "export LC_CTYPE=en_US.UTF-8" >> ~/.zshrc
Step 2. Reload the zsh environment.
source ~/.zshrc
As an alternate solution, try disabling Terminal’s Set locale environment variable on startup
option found under Terminal → Settings → Profiles → International.
Linux
Step 1. If using the default Bash shell, basically, do the same as the macOS solution.
echo "export LC_ALL=en_US.UTF-8" >> ~/.bashrc
echo "export LC_CTYPE=en_US.UTF-8" >> ~/.bashrc
Step 2. Reload the bash shell environment.
source ~/.bashrc
If that doesn’t do the trick, try running the following sequence of commands:
sudo apt update
sudo apt install locales
locale-gen en_US.UTF-8
dpkg-reconfigure locales
Conclusion
That worked for me though. But, if you are still having the same issue, feel free to leave a comment below. And, in case you found this tutorial useful, follow our official channel on Telegram.