The built in libreadline on macOS does not have append_history, causing the writing of the history file to fail on exit. I tried to submit a PR but did not have permission. Here is my change:
line 373
# Check for missing append_history. Will fail on macOS
if "append_history" not in dir(readline):
readline.write_history_file(config.HISTFILE)
return