Basically, you want to start now.
It takes time to find a press, have reviews done, get a final answer, etc., so the sooner you start--even before you have a TT job--the better off you will be in the end.
I struggled with this myself. I've concluded that bibliotechula's right up to a point (and possibly further!). Here's what I've concluded. First, my primary goal has been to write, write, write. Getting the manuscript to a suitable stage was the first priority.
Then things get muddy. At three different campus visits, I've been told that anything that I did prior to starting the job would not "count" towards tenure. For that reason, ideally I would want a book contract
after I begin on the TT. The problem, of course, is that having a contract and even a published book would make me far more attractive as a candidate. It's a difficult balancing act, I think. For two reasons, I had decided to push forward rather than wait: 1) I sensed that some schools recognize a book as a long-term project that would count towards tenure regardless of where I happened to be at the time it eventually came out, and 2) I gambled that I'd be on the TT by the time the book showed up in print even if it was accepted for publication before landing that job.
Good luck!