ObjectiveTo investigate the effect of M2 macrophage-related genes on prognosis and drug therapeutic effect in patients with liver cancer. Methods(1) The gene expression data of liver cancerous tissue samples of 374 patients with liver cancer and 50 normal tissues samples were obtained from the Cancer Genome Atlas (TCGA) database. The CIBERSORT algorithm was used to obtain liver cancerous tissue samples associated with M2 macrophage. By analyzing the correlation between gene expression and relative content of M2 macrophage, the liver cancerous genes related to M2 macrophage were obtained. (2) The Gene Ontology (GO) functional enrichment analysis and Kyoto Encyclopedia of Genes and Genomes (KEGG) pathway enrichment analysis on liver cancerous genes related to M2 macrophage were performed by using R language Bioconductor package. (3) By the univariate COX regression analysis and LASSO regression analysis, the prognostic genes of liver cancer related to M2 macrophage were determined, and then the risk score formula was established according to the prognostic genes of liver cancer obtained. Patients with liver cancer were assigned to high-risk group or low-risk group according to the risk score, and the survival time was compared between patients of the two groups. (4) The gene mutation data of liver cancer were downloaded from the TCGA database, and the limma package of R language was used to perform the differential expression analysis of tumor gene mutation data in the high-risk group and the low-risk group to obtain the difference in tumor mutation burden between the two groups. The oncoPredict package of R language was used to perform the drug sensitivity analysis on gene expression data of patients with liver cancer, and limma package of R language was used to perform the difference analysis on drug sensitivity results between the high-risk group and the low-risk group. Results(1) A total of 110 liver cancerous genes related to M2 macrophage were obtained. (2) The results of GO functional enrichment analysis revealed that liver cancerous genes related to M2 macrophage were involved in many biological processes, including endothelial cell development. The results of KEGG pathway enrichment analysis also depicted that endothelial cell development signaling pathway was the main pathway which liver cancerous genes related to M2 macrophage were involved in. (3) Finally, 4 prognostic genes of liver cancer related to M2 macrophage were obtained, namely CLEC3B, LMNB1, TAF9 and SYNGR4. The risk score =-0.24×CLEC3B+0.008×LMNB1+0.230×TAF9+0.006×SYNGR4. Patients with liver cancer in the high-risk group obtained shorter survival time as compared with the low-risk group (P<0.05). (4) Tumor mutation burden of the high-risk group was higher than that of the low-risk group (P<0.05). 5-fluorouracil, afatinib and alpelisib were relatively sensitive in the low-risk group, while AT13148 inhibitor was relatively sensitive in the high-risk group (all P<0.05). ConclusionMultiple genes related to M2 macrophage play an crucial role in the occurrence and development of liver cancer. Among them, CLEC3B, LMNB1, TAF9, and SYNGR4 are closely related to the prognosis of patients with liver cancer, and are helpful to evaluate the efficacy of immunotherapy and anticancer drugs.