knowyourphrase.com - The Origins of Phrases and the Meanings of Sayings
Note: The origins for a phrase are very unclear, much of the time. The origins you see listed here are the plausible theories floating around for how or where an idiom came from, but may not necessarily be accurate. The quotes which have the phrase in them are pretty much the oldest written forms of the phrase I could find, but keep in mind that older recordings could exist and I am simply unaware. If you find an earlier citation than what I have, feel free to let me know!
Also, remember that just because you see a saying in an old book or newspaper, let's say from the year 1893, it does not mean the saying originates from that source or from that year. In all likelihood, if an expression is already being used in a book or newspaper, then it's probably already well established at that time and dates back even further. Nevertheless, these old quotes serve as a way to show readers how far back in history some of these popular sayings go, which is quite interesting!
The origin of this phrase is believed to be rooted in carnivals. Carnivals have many different types of games that can be played, some are based around accuracy, others on strength. Prizes are usually awarded to the winners, while the losers are left with nothing at all. Big stuffed animals are common prizes that are handed out to the winner, among other types of toys.
Well, from what I've read, apparently there may have been a time in the 20th century where cigars were among the prizes that could be won. If this is true, then I could picture the owner in charge of a carnival game shouting this particular phrase to contestants who came close to winning a prize, but just missed it. For example, there's a certain strength based carnival game known as "high striker." In this game, the player takes a mallet and swings it as hard as they can at a target. When the target is struck, a metallic object rises up a set distance depending on the severity of the swing; if the target is hit hard enough, the metallic object rises up and strikes a bell at the top, which means the player has won. It was probably rather common for players to fall just shy of ringing the bell, thus, the owner in charge of the game might tell the player: "Close, but no cigar," indicating that the player was close to winning, but didn't quite make it far enough to win anything. Perhaps this expression originates from something along these lines.
This idiom looks to go back to at least 1934, where it appears in writing in a Pennsylvania newspaper called the Chester Times:
"An unseen pedestrian loomed before their headlights, narrowly dodged the sliding wheels.
'Close, but no cigar,' the lieutenant shouted."
Reference: newspaperarchive contained a digital copy of the newspaper with the saying in the quote above.
* Having not fired a crossbow in years, I took my first shot with it this morning at a nearby tree and missed! I was close, but I get no cigar for that attempt.
* My coach yelled 'close, Mike, but no cigar,' when I was unable to break my previous record on the 100 yard dash.