This question already has an answer here:
I am trying to get Z Pass to render but all I get is a white image. Any ideas why that happens?
I tried setting up the render layers, checked only z-pass since that's all I need but still can't get it going. I am having a similar issue when trying to output to PNG's other passes but they do show up however at least in the viewer.
Also I tried looking up for tuts on this but what I found is only for internal compositor unfortunately.