Unicode in Racket on macOS

A brief guide to using Unicode in the Racket REPL on macOS.


Racket has built-in support for Unicode. It even uses it in keywords. For example, these two expressions are equivalent:

(lambda () "Hello")
(λ () "Hello")

However, Unicode doesn’t work in the REPL by default (at least on macOS). Here’s one way to get it working:

  1. Install the GNU Readline library with Homebrew.

    brew install readline
    
  2. Install the readline-gpl package.

    raco pkg install readline-gpl
    
  3. Change to the lib directory adjacent to where racket is installed.

    cd /Applications/Racket\ v7.8/lib
    
  4. Create a symbolic link to libreadline.dylib from the lib directory.

    ln -s /usr/local/opt/readline/lib/libreadline.dylib
    

Now run racket again. If all went well, you can type all the λs you like.