The original script called for filming on an outdoor location but, due to budget constraints, filming took place in the studio. These constraints also prevented the set designers from building a complete Western town and the concept of pieces of a town drawn from Kirk's mind was developed.
For the third season, the velour tunics from the first two seasons have been replaced by polyester ones, which are better-fitting but lack the luster of the original velour. The new fabric was a heavy diamond-weave nylon double-knit material akin to that used in professional baseball uniforms. The switch was made because the original velour shrank every time it was dry-cleaned. This was a problem because union rules required that costumes be cleaned before each use.
DeForest Kelley appeared in other dramatizations of the same historical events, playing Ike Clanton in The Gunfight at the O.K. Corral (October 26, 1881) (1955) and Morgan Earp in Gunfight at the O.K. Corral (1957). He was also offered a role in Hour of the Gun (1967) (the movie this episode is named after) but had to decline due to his Star Trek commitment.
Gene Roddenberry originally wanted to film 'Spectre of the Gun', about the Gunfight at the O.K. Corral, in Arizona, either at Old Tucson Studios in Tucson, Arizona, or at Apacheland Studios in Apache Junction, Arizona. He found out that there was no budget to do it and had to rely on camera angles, bright colorful lights, and dreamlike sets, which added to the episode's strange alien quality.
The writing of this episode was influenced by NBC executives who wanted Chekov to be featured more in the third season than he had been in the second season.