SQLite Arrow Key Navigation Support

The standard SQLite shell on macOS doesn’t support arrow key navigation like many standard CLI programs do. Pressing up, down, right, and left in that order outputs the following escape codes in the shell

Terminal window
sqlite> ^[[A^[[B^[[C^[[D

A program called rlwrap can shim arrow key support into sqlite. Install rlwrap (it’s supported by Homebrew and Nixpkgs) then run

Terminal window
rlwrap sqlite <the rest of the command>

and it should just work.