editline/history.h and editline/readline.h not found/working on macOS when trying to compile with developer tools installed already
Include only #include <editline/readline.h> which should exist if the command line tools are installed. This file contains the “readline wrapper” for libedit, including the history functions as well. An include file <editline/history.h> does not exist on OS X. I tested your code with that modification, and it compiled and ran without problems.