Error message exporting to Kindle (mobi) format


I’m trying to export my ebook to Kindle format. I’ve downloaded Kindle Previewer (v.3.52) but when I hit compile I get this error message: “KindleGen failed to generate a .mobi file at the expected location.” I’m using a Mac.

After browsing prior posts I also tried the epub format, but this results in a horribly messed-up book (TOC a mess, some formatting missing, error messages embedded in the file, etc.).

Any advice?