Caveat: I am on the latest Mojave version with Xcode and the command line utilities installed and the following instructions work for me :)
If you don't have Xcode and the command line utilities, install them first.
1) install the headers so that the build process can access them:
command: cp /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg ~/Desktop
and then double-click on the package to install them in /usr/include
2) get emacs from its git repository
command: git clone -b master git://git.sv.gnu.org/emacs.git
3) enter the emacs directory and run "make install"
Emacs.app will be found in the nextstep/ directory
You can call it with Spotlight, and you can modify your path or create aliases so as to access the corresponding "emacs" command from the command line.
Once you have that done, just do a "git pull" regularly to get what's new and rebuild when you want to use the new code.