BACKGROUND: Surface populations of Astyanax mexicanus, living in rivers like their common ancestors, school, while several, independently derived cave populations of the same species have lost schooling behavior. RESULTS: We quantify schooling behavior in individual A. mexicanus and identify quantitative trait loci (QTL) for this trait. We find that the evolutionary modulation of schooling has both vision-dependent and -independent components. We also quantify differences in the lateral line and vision between cavefish and surface fish and relate these differences to the evolutionary loss of schooling behavior. We provide evidence that a monoamine neurotransmitter may have played a role in the evolution of schooling behavior. CONCLUSIONS: We find that vision is essential for schooling tendency in A. mexicanus, while the lateral line has a small effect on this behavior. Schooling behavior in A. mexicanus has evolved both through changes in sensory systems and through changes in genetic loci that likely act downstream of sensory inputs.