Skip to content

Mac iTerm2 login CentOS warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory


Reason for Error

There is no utf-8 language (language_country prefix not added), and LC_ALL has not been set.

Server-side Solution

On the remote system, add the following two lines to /etc/environment, and then log in again.


Mac Solution

Edit the .bashrc or .zshrc file and add the following:

export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8

  • Welcome to visit the knowledge base of SRE and DevOps!
  • License under CC BY-NC 4.0
  • Made with Material for MkDocs and improve writing by generative AI tools
  • Copyright issue feedback, replace # with @