Glutamylation is a post-translational modification found on tubulin that can alter the interaction between microtubules (MTs) and associated proteins. The molecular mechanisms regulating tubulin glutamylation in response to the environment are not well understood. Here, we show that in the sensory cilia of Caenorhabditis elegans, tubulin glutamylation is upregulated in response to various signals such as temperature, osmolality, and dietary conditions. Similarly, tubulin glutamylation is modified in mammalian photoreceptor cells following light adaptation. A tubulin glutamate ligase gene ttll-4, which is essential for tubulin glutamylation of axonemal MTs in sensory cilia, is activated by p38 MAPK. Amino acid substitution of TTLL-4 has revealed that a Thr residue (a putative MAPK-phosphorylation site) is required for enhancement of tubulin glutamylation. Intraflagellar transport (IFT), a bidirectional trafficking system specifically observed along axonemal MTs, is required for the formation, maintenance, and function of sensory cilia. Measurement of the velocity of IFT particles revealed that starvation accelerates IFT, which was also dependent on the Thr residue of TTLL-4. Similarly, starvation-induced attenuation of avoidance behaviour from high osmolality conditions was also dependent on ttll-4. Our data suggest that a novel evolutionarily conserved regulatory system exists for tubulin glutamylation in sensory cilia in response to the environment.