I was getting errors such as
man: can't set the locale; make sure $LC_* and $LANG are correct when SSH’ing my Raspberry Pi box. Suggested fixes such as
dpkg-reconfigure locales didn’t help (I got a new error after selecting the correct locale –
/usr/bin/locale: Cannot set LC_CTYPE to default locale: No such file or directory).
This AskUbuntu thread has a good explanation of the problem and possible fixes. This StackOverflow thread has a good explanation of the Language variables themselves. It is common for macOS users coz the macOS
/etc/ssh/ssh_config file exports all the language variables and that confuses the remote machine. If you don’t want to fix it cleanly, a “rough” solution is to disable sending of language variables in the Terminal app or iTerm. Special shoutout to this answer from the aforementioned AskUbuntu thread that explains the problem well and gives a good fix.