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

Oh Dear! monitors your entire site, not just the homepage. We crawl and search for broken pages and mixed content, send alerts when your site is down and notify you on expiring SSL certificates.

Start your free 10 day trial! »

Image of Mattias Geniar

Mattias Geniar, October 21, 2019

Follow me on Twitter as @mattiasgeniar

On a freshly installed CentOS 7 machine, I got the following notice when I SSH’d into the server.

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

The fix is pretty straight-forward. On the server (not your client), edit the file /etc/environment and add the following lines.

(You’ll need root privileges to do this)

$ cat /etc/environment
LANG=en_US.utf-8
LC_ALL=en_US.utf-8

Log out & back in and you should notice the warning message is gone.

Will you help me share this post?

It would mean a lot to me if you could help share this post on social media. 🤗