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:
-
Install the GNU Readline library with Homebrew.
brew install readline
-
Install the readline-gpl package.
raco pkg install readline-gpl
-
Change to the
lib
directory adjacent to whereracket
is installed.cd /Applications/Racket\ v7.8/lib
-
Create a symbolic link to
libreadline.dylib
from thelib
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.