In 1947, engineers working on Harvard University’s Mark II computer found a bug gumming up the works—a moth had squeezed into one of the machine’s components. After extracting it, somebody taped it to the log book with the caption “first actual case of a bug being found.” That log book, with moth intact, is in the collection of the Smithsonian Institution’s National Museum of American History today. Scholar Fred R. Shapiro describes what supposedly happened next:
“The moth is said to have inspired the scientists to speak from then on of debugging the computer, with bug originating as the later back-formation from debug.”
So “debug” and “bug” were bits of computer slang that were eventually adopted by the larger culture. It’s a great story—but not very etymologically correct.
The story has been nearly canonized by the presence in the lab of Grace Murray Hopper, a pioneering computer scientist who retired with the rank of Rear Admiral in the US Navy. Some have attributed the naming of the first computer bug to her: the Annals of the History of Computing described it as “Grace Murray Hopper’s famous ‘bug’ story” in a 1981 article, “The First Bug.” Others have been more cautious, suggesting she “likely made the incident famous.” The Smithsonian’s description of the item notes that the log book “was probably not Hopper’s.”
The real bug in this narrative, as Shapiro points out, is that “bug” in this sense actually goes back to the late nineteenth century. The Supplement to the Oxford English Dictionary’s fourth definition of the noun “bug” reads “a defect or fault in a machine, plan, or the like.” The OED cites the March 11, 1889, Pall Mall Gazette as a source: “Mr [Thomas] Edison… had been up the two previous nights discovering a ‘bug’ in his phonograph—an expression for solving a difficulty, and implying that some imaginary insect had secreted itself inside and is causing all the trouble.”
And then there’s also a letter, written by Edison in 1878, in which he refers to “‘Bugs’ as such little faults and difficulties are called.” By the publication of the 1934 Webster’s New International Dictionary, the third definition for the noun bug was: “a defect in an apparatus or its operation.”
Computer people adopted a term in use for more than half a century and brought it into the digital world. The wording in the Harvard log book—“first actual case of a bug being found”—suggests the computer programmers and engineers there were already quite familiar with the time-honored usage and were remarking on the novelty of finding an actual insect bugging up the computer. “Debug,” by the way, was also used in an 1945 issue of the Journal of the Royal Aeronautical Society, which Shapiro takes to suggest it was “probably preceded by several years of oral use in engineering slang.”
Nevertheless, etymological folklore, as Shapiro notes, is “remarkably persistent.” The Harvard lab log book, after all, is in the National Museum of American History, even with its caveats. Fanciful word-stories can overcome “lack of documentation, lack of plausibility” and “even outright disproof” to become popular legend.
It may be, however, that folk etymology has nothing on folk entomology. To the general public, bug is synonymous with insect. To an entomologist, a bug is more specifically a member of the insect order Hemiptera (“half-winged”), which includes cicadas, aphids, hoppers, shield bugs, and bed bugs. The Mark II “bug,” on the other wing, was a moth, part of the insect order Lepidoptera (“scale-winged”).