On Star Trek TOS episode S03E10 For the World is Hollow and I Have Touched the Sky Bones says he has a deadly disease for which there is no cure.
At the end of the episode he is fine, so how did they cure Dr. McCoy of his fatal disease?
McCoy and Natira share a tearful farewell: She must stay to lead her people to the promised land and McCoy is determined to keep traveling the universe in search of a cure for his disease as well as for others afflicted.
After correcting the Yonada's course, Spock shows Kirk the cylinders containing the vast database of the Fabrini, which contains medical knowledge, including the cure for xenopolycythemia.
McCoy undergoes the very painful treatment for his illness, with Nurse Chapel at his side in the Enterprise's sickbay. Emerging cured, Kirk promises him the Enterprise will soon return to the area in 390 days when the Yonada eventually reaches its correct destination. McCoy is pleased by Kirk's promise and the Enterprise leaves Yonada.
Near the end of the episode Spock discovers a vast wealth of data stored in the asteroid-ship's central computer. Among the information stored there is the cure for Xenopolycythemia. From the episode transcript:
SPOCK: (spotting shelves of discs) Captain. Intelligence files. Their banks contain the total knowledge of the Fabrini, ready for the people to consult when they arrive at their destination. (scans them) And they seem to have amassed a great deal of medical knowledge.
(McCoy is on the biobed. Chapel gives him an injection at Spock's signal.)
CHAPEL: Excellent, Doctor. The white corpuscle count is back to normal. (McCoy groans.)
SPOCK: Your haemoglobin count is back to normal, Doctor, which indicates that the flow of oxygen to each cell of your body is back up to its abundantly energetic level.
MCCOY: Thank you, Mister Spock, for bringing back the knowledge of the Fabrini.