Although recent studies have provided significant molecular insights into the establishment of neuronal polarity in vitro, evidence is lacking on the corresponding phenomena in vivo, including correct localization of synaptic components and the importance of this process for function of the nervous system as a whole. RIA interneurons act as a pivotal component of the neural circuit for thermotaxis behavior in the nematode Caenorhabditis elegans and provide a suitable model to investigate these issues, having a neurite clearly divided into pre- and post-synaptic regions. In a screen for thermotaxis mutants, we identified the gene ttx-7, which encodes myo-inositol monophosphatase (IMPase), an inositol-producing enzyme regarded as a bipolar disorder-relevant molecule for its lithium sensitivity. Here we show that mutations in ttx-7 cause defects in thermotaxis behavior and localization of synaptic proteins in RIA neurons in vivo. Both behavioral and localization defects in ttx-7 mutants were rescued by expression of IMPase in adults and by inositol application, and the same defects were mimicked by lithium treatment in wild-type animals. These results suggest that IMPase is required in central interneurons of the mature nervous system for correct localization of synaptic components and thus for normal behavior.