Skip to content

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

报错原因

没有utf-8这个语系(没添加语言_国名前缀),LC_ALL又没设定值。

服务端解决方法

在远程系统上, /etc/environment 加入以下两行,重新登陆即可。

LANG=en_US.utf-8
LC_ALL=en_US.utf-8

Mac端解决方法

编辑.bashrc或者.zshrc文件,添加

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

Disclaimer
  1. License under CC BY-NC 4.0
  2. Copyright issue feedback me#imzye.me, replace # with @
  3. Not all the commands and scripts are tested in production environment, use at your own risk
  4. No privacy information is collected here
Try iOS App