There are posts all over this forum, as well as the AnswerHub from people having a hard time getting HTML5 up and running. I did it and wrote down how, including one need on OS X Yosemite (launchd.conf doesn’t work). Here’s how I got it working, as well as a permalink for sharing. I’ll try to keep both up to date if the process changes.
- Go to Unreal Engine and log into your account and click ‘Get Unreal’. Look to the bottom section of the page to get UE4 full source code. You’ll need to link your Unreal account to your GitHub account.
- Fork and clone the UE4 repository.
- Install the latest version of Xcode.
- Install Firefox Nightly.
- Install Emscripten (modified from these instructions):
a. Download and unzip the portable SDK package. This will contain the Emscripten SDK. Navigate to it in Terminal.
b. emsdk update
c. emsdk install latest
d. emsdk activate latest
e. source ./emsdk_env.sh
f. Restart your Mac.
g. Setting Emscripten environment variables via launchd.conf is a no-go on Yosemite. Do this instead ($EMSDK_PATH is the path to where you’ve installed the emscripten sdk. $VERSION will vary as well, but there’s only one folder at that path at this time):
- launchctl setenv EMSCRIPTEN $EMSDK_PATH/emscripten/$VERSION
- launchctl setenv EMSCRIPTEN_ROOT $EMSDK_PATH/emscripten/$VERSION
- launchctl setenv LLVM_ROOT $EMSDK_PATH/clang/$VERSION
- launchctl setenv NODE_JS $EMSDK_PATH/node/$VERSION
- NOTE: This has to be done every time you restart unless you set up something automated. Happily, we only need it to build UE4, not to use it.
- Execute Setup.command by double clicking in Finder or executing on the command line to download binary content for the engine. If Emscripten is set up correctly, HTML5 will not be included in the list of excluded items in the execution output.
- Execute GenerateProjectFiles.command.
- From the same directory, execute ./Engine/Build/BatchFiles/Mac/Build.sh UE4Game HTML5 Development. One of the things this creates is the UE4Game.js file that is critical for building HTML5 project.
- Load the project into Xcode by double-clicking on the UE4.xcodeproj file. Select the UE4Editor - Mac for My Mac target in the title bar, then select the ‘Product > Build’ menu item. This will take anywhere from 15 to 40 minutes.
- After compiling finishes, select the ‘Product > Run’ menu item to load the editor.
This took quite a while to get right and it’s conceivable I missed something so let me know if I missed a step and I’ll update.