If your goal is getting a PDF, you might try my
epub2pdf script. It does not use TeX, but another program called Prince, which can create PDFs directly from (X)HTML, with similar typographic features to TeX. Since you are on OSX and comfortable with shell scripting, it should be easy for you to use it