Great Stuff, being able to type utf-8 characters in a Terminal on OS X!

I know what you are thinking: »Those poor OS X users with their mutilated unix user land. I wrote about the ancient version of locate that OS X ships with, now this also applies to the standard shell, bash. OS X ships with version GNU bash, version 2.05b.0(1)-release, which just like locate has poor or non UTF-8 support. If you start typing characters like ä, ü or ö you get everything but that. You can’t search for them and so on. Seriously, this is so weak but again, you can help yourself with MacPorts. I found this article on the web, describing the steps nessecary for enabling UTF-8 in, iTerm and X11 Term. For the sake of redundant information storage I’ll give you the management summary for

  1. Use MacPorts to install the latest version of bash: sudo port -c install bash (-c is for autoclean mode)
  2. Edit /etc/shells and add the path to the new version of bash which is /opt/local/bin/bash
  3. Edit ~/.profile and add the following lines:
    export LC_ALL=de_DE.UTF-8
    export LANG=de_DE.UTF-8

    This adds support for german utf-8 characters. Use locale -a to find your favorite language code.
  4. Run chsh and change the path of the shell to /opt/local/bin/bash
  5. Open the window settings, select Display and make sure the drop-down at the bottom is set to UTF-8 and make sure Wide Glyphs are enabled too. Then click the »Use Settings as default« button.
  6. Restart – Tada.wav
  7. If it doesn’t work open the preferences and see if you manually set the shell path, if so change it to to /opt/local/bin or switch back to the default login shell

Now if you want to have UTF-8 support in locate and all the other tools as well, you have to read my previous post about findutils and coreutils.

Afterwards you are able to do things like this and feel less handicapped.

:~ $ touch äüö
:~ $ ls äüö
:~ $ rm äüö
:~ $

Leave a Reply

Your email address will not be published. Required fields are marked *