Assuming we are talking pure mech here no barracks units. If he starts making barracks units you can start playing more regularly.
When playing vs mech it is key to abuse his immobility. How do you do that?
First of all you can take bases earlier than normal but make sure you lock everything down or blue flame hellions will roast you.
If his 3rd is easy to take just let him have it but delay if at all possible, and keep scouting. Often terran (well I did anyway) will take their 3rd earlier than they can actually defend it if he hasnt seen you poking around.
I think a roach based army works best, get drop/speed and obviously speed/burrow relatively early (you can totally destroy him with burrow roach play, sniping CC/planetary/harassing if he isnt ready) and just constantly make him be defensive. Hit where he is weakest and ****, your goal here is to be smart.
His 4th base should be very slow if he gets it at all. At this point you may want to start getting Broodlord, or you could of got it earlier and just enter regular zerg late game of switching between broodlord and ultra. Have a spire in case he gets banshees.
You should always be on more base than him as mech is immobile as **** and has 0 map control. If he goes for a death push and you cant stop it by sending wave after wave of your own men (roaches) at him until he reaches his kill limit and shuts down, trade bases with him. You will actually come out better off a lot of the time because you have more bases and he is really immobile, this is a very viable way of beating mech.
That was a very rambly post and I havent played the game in 6-8 months so whatever.