Install nginx module after installation mac osx
You could use nginx-full. This allows you to include the module you want. Here are the instructions:
brew tap homebrew/nginxbrew install nginx-full --with-realip
More information in https://github.com/denji/homebrew-nginx