PCRE, Lua & LuaJIT

Note down the installed version, you'll need this information in the next step.

Luarocks

Install Lua's package manager.

Luarocks is installed by default when installing Lua 5.2 with Homebrew, but since we're using Lua 5.1 (for compatibility with OpenResty) we need to install it manually. To do so, download the latest Luarocks from the official repository (at the time of the writing, it's v2.2.2), untar the file and then install it:

$ ./configure
$ make build
$ make install

MySql

If you're planning to use MySql, you'll need to have an installed MySql copy together with its header files so that LuaDBI can be compiled.

Assuming you have installed OpenResty into /usr/local/openresty (this is the default), make the nginx executable of your OpenResty installation available in the PATH environment, appending at the end of ~/.bash_profile:

export PATH=/usr/local/openresty/nginx/sbin:$PATH

Check to see if OpenResty got successfully installed (you might need to source ~/.bash_profile or just restart the terminal for this to work):