Origin of "bug" in reference to software

What is the origin of the expression bug when used to refer to software? Wikipedia says it's from 1843 in Ada Byron's notes on the analytical engine. Another source I found was on dictionary.com:

The latter observation may explain a common folk etymology of the term; that it came from telephone company usage, in which "bugs in a telephone cable" were blamed for noisy lines. Though this derivation seems to be mistaken, it may well be a distorted memory of a joke first current among telegraph operators more than a century ago!

It seems to me that nobody really knows and that it's just a reference that came into being maybe through another domain than software and eventually creeped into it when computers and software were born. I've always thought that it might have been because an actual bug (insect) went into a mechanical calculator and got jammed somewhere which messed the process.


Solution 1:

The story I've always heard was that Adm. Grace Hopper coined the term "debugging" when a moth was removed from the computer she was working on. Here's a link to Adm. Hopper's bio, including a picture of the notebook page in which the first bug was immortalized:

picture of first computer bug

http://usnhistory.navylive.dodlive.mil/2014/12/09/grace-hopper-navy-to-the-core-a-pirate-at-heart/

Update: Wikipedia shows the same picture, and says that "bug" and "debug" were in use before the "first actual computer bug." Wikipedia's version of the etymology of "bug" says that the term had been in use in engineering for decades before the taping of the moth, and that the moth was taped into the notebook because those who found it knew the term's meaning in engineering. That seems to make more sense -- taping an actual moth into the log book would have been more gross than funny had the term "bug" not already been familiar to those in the group. In my own experience, Adm. Hopper's name has been associated with "bug" every time I've heard or read this story, probably because she often told the story herself. So, while she apparently did not coin the term, I think she deserves significant credit for cementing "bug" in the programmer's daily lexicon.

Solution 2:

Use of bug in the general sense of a disruptive person is in Shakespeare Henry VI, part III - Act V, Scene II: King Edward:
“So, lie thou there. Die thou; and die our fear; For Warwick was a bug that fear'd us all.”

Samuel Johnson's dictionary defines bug as “A frightful object; a walking spectre” from ‘bugbear’, a Welsh term for a mythological monster

The earliest use in the software sense seems to be Edison:

... Edison in the year 1889: In that year, the Pall Mall Gazette reported that "Mr. 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 has secreted itself inside and is causing all the trouble."