Sigil is also the name of an EPUB editor. It's a bare-bones but very effective piece of software, especially given that it's free as in beer. Its Java roots are quite clear from its inconsistent UI behavior on Mac OS X, but that's not a huge problem. As an example, it opens with a blank EPUB project open, and if you close that - closing the last app window - it automatically quits. So to open an existing EPUB, you have to open the app, then open the desired EPUB, then close the now-superfluous empty project.

This is a sharp tool, in the unix sense. Although it will do the most basic of tasks for you in a very clean way, it will also let you cut yourself with no or only bare minimum warnings. It will let you directly edit the contents.opf file, even through it has a basic metadata editor. Be warned, though - if you have an existing contents.opf and then start using the built-in metadata editor, it will erase all the non-basic entries in your contents.opf and replace them with the few you've put in via the editor. It won't interpret existing entities into the editor dialog; it only knows a few basic field types.

An EPUB is essentially a directory tree containing HTML, CSS, font and image data in a standard form, with some XML thrown in for good measure. The 'empty project' that Sigil throws up is enough to get you a working EPUB, and from there it's relatively easy to start improving on or adding to that.

I do recommend making interim backup copies of your work, though. As with all manual or semi-manual markup language and XML editors, you will inevitably make a change that makes you crazy and need to go back to a known clean state.

Sigil gives you the ability to edit your text in sort-of a WYSIWYG view, but I tend to always use the tag view. It helps produce much cleaner HTML.

If you're curious, I strongly recommend grabbing a free EPUB from the internet - Project Gutenberg has tons - and just opening them in Sigil to get an idea of the various formatting options and directions you can go in, or open a commercial EPUB to get a sense of the kind of metadata that you can put into the contents.opf if you get ambitious.