What ?

Using iTerm2 on macOS, while running any command through ssh on my Raspberry (running Raspian 11), I was getting this warning

...
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_COLLATE to default locale: No such file or directory
C
C.UTF-8
POSIX
en_GB.utf8
...

How I fixed it

Update iTerm settings

  • Go to Profiles
  • Select Default (or your default profile)
  • Terminal
  • Environment -> Choose en_US.UTF-8
  • Close and save

Uncomment en_US.UTF-8 in the /etc/locale.gen file

# /etc/locale.gen
en_US.UTF-8 UTF-8

save your change, then run

sudo locale-gen

Done!

Credits

Photo by Anto Meneghini on Unsplash