Much of the episode was filmed around the desert area of Almería, Spain, where studios have built Wild West-style streets that have been used in the making of over 100 Western-set films, such as The Dollars Trilogy.
While Matt Smith was allowed to try riding the horse, most of the action shown in the episode was done by his stuntman.
Ben Browder, veteran of sci-fi epics Farscape (1999) and Stargate SG-1 (1997), accepted his role because his children were fans of the series and he also wanted to do a western.
The Doctor's confrontation with the townspeople outside the jail was inspired by To Kill a Mockingbird (1962).
Toby Whithouse felt obliged to include common Western tropes, such as the Doctor riding a horse and a face-off. He stated the hardest scene to write was where the Doctor is forced to use a gun; the Doctor is a pacifist and he would need "the right sort of emotional journey".