Background: Immunopathology contributes to the high mortality of tuberculous meningitis, but the biological pathways involved are mostly unknown. We aimed to compare cerebrospinal fluid (CSF) and serum metabolomes of patients with tuberculous meningitis with that of controls without tuberculous meningitis, and assess the link between metabolite concentrations and mortality. Methods: In this observational cohort study at the Hasan Sadikin Hospital (Bandung, Indonesia) we measured 425 metabolites using liquid chromatography-mass spectrometry in CSF and serum from 33 HIV-negative Indonesian patients with confirmed or probable tuberculous meningitis and 22 control participants with complete clinical data between March 12, 2009, and Oct 27, 2013. Associations of metabolite concentrations with survival were validated in a second cohort of 101 patients from the same centre. Genome-wide single nucleotide polymorphism typing was used to identify tryptophan quantitative trait loci, which were used for survival analysis in a third cohort of 285 patients. Findings: Concentrations of 250 (70%) of 351 metabolites detected in CSF were higher in patients with tuberculous meningitis than in controls, especially in those who died during follow-up. Only five (1%) of the 390 metobolites detected in serum differed between patients with tuberculous meningitis and controls. CSF tryptophan concentrations showed a pattern different from most other CSF metabolites; concentrations were lower in patients who survived compared with patients who died (9-times) and to controls (31-times). The association of low CSF tryptophan with patient survival was confirmed in the validation cohort (hazard ratio 0·73; 95% CI 0·64-0·83; p<0·0001; per each halving). 11 genetic loci predictive for CSF tryptophan concentrations in tuberculous meningitis were identified (p<0·00001). These quantitative trait loci predicted survival in a third cohort of 285 HIV-negative patients in a prognostic index including age and sex, also after correction for possible confounders (p=0·0083). Interpretation: Cerebral tryptophan metabolism, which is known to affect Mycobacterium tuberculosis growth and CNS inflammation, is important for the outcome of tuberculous meningitis. CSF tryptophan concentrations in tuberculous meningitis are under strong genetic influence, probably contributing to the variable outcomes of tuberculous meningitis. Interventions targeting tryptophan metabolism could improve outcomes of tuberculous meningitis. Funding: Royal Dutch Academy of Arts and Sciences; Netherlands Foundation for Scientific Research; Radboud University; National Academy of Sciences; Ministry of Research, Technology, and Higher Education, Indonesia; European Research Council; and PEER-Health.