Install macports, install readline.
Install luajit.
Install luarocks.
Edit luarocks_installed/etc/luarocks/config-5.1.lua to use libs from /opt/local (those from macports):
external_deps_dirs = {
"/opt/local",
}
In luarocks install inspect, prompt.
/luarocks_installed/bin/luap
Enjoy repl with history and autocomplete.