Development The episode was written by
Doctor Who showrunner
Russell T Davies. Davies said he first got a rough idea for the episode 40 to 50 years earlier. Davies gave a list of five previous stories that he suggested viewers watch before the episode released. The episode draws together many loose threads and previous
story arcs. Some of these storylines also continued to explore plot threads surrounding the
Timeless Child, which previous showrunner
Chris Chibnall introduced during his era. Davies originally intended the episode to begin with a
cold open at an American coffee bar in 1947. The episode had a working title of "Chrysalis". The story re-introduces Sutekh to
Doctor Who after his only previous televised appearance in the 1975 serial
Pyramids of Mars, where he battled against the
Fourth Doctor (
Tom Baker). Sutekh is based on the Egyptian deity
Set, which accords with Davies's goal of bringing more gods to the programme. He was also revealed to be "the one who waits", mentioned to the Doctor by the Toymaker in "
The Giggle" (2023), and the leader of the Gods of Chaos, another member of which was encountered in "
The Devil's Chord" (2024). It is the first episode in a two-part story, concluding in the following week's episode, "
Empire of Death". The two episodes were bridged by an episode of
Tales of the TARDIS, presenting
Pyramids of Mars with updated special effects.
Filming "The Legend of Ruby Sunday" was directed by
Jamie Donoughue, who compared the two-part finale to a
feature film. It was produced in the series's fifth production block, along with the following episode, from 5 June to 14 July 2023. To create the scene of the TARDIS crashing into the UNIT headquarters, a tennis ball was rolled down the aisle on the set to allow for interaction with the performers. The TARDIS was later added using visual effects. Millennium FX designed the mask for Twist's character with the goal of accentuating her bone structure without suggesting the appearance of a
zombie. Codenames were used while filming in public to keep the episodes' antagonists a secret. Some of the story was filmed at One Central Square in
Cardiff in June 2023. while
Bonnie Langford guest-starred as former
Sixth and
Seventh Doctor companion
Mel Bush. Langford had returned to
Doctor Who in "
The Giggle" (2023) after a 36-year absence. Langford described her role in the episode as "
camp as hell". Additionally,
Yasmin Finney returned as Rose Noble, the daughter of former companion
Donna Noble, following her introduction in "
The Star Beast" (2023). reprised her role as former companion
Mel Bush.
Susan Twist made an appearance as Susan Triad, the head and founder of the fictional company S Triad Technology. Twist first appeared in "
Wild Blue Yonder" and made a further appearance in "
The Church on Ruby Road" before appearing in every episode of the fourteenth series as seemingly disparate characters. These roles were ultimately connected in the episode, with "S Triad" an anagram for "TARDIS" and "S Triad Technology" (as in
Susan Triad Technology) being abbreviated to "Sue Tech", a homophone of "Sutekh". References to "Triad Technology" had been planted in
Doctor Who as early as "The Giggle", where the company was mentioned in dialogue, as well as "The Church on Ruby Road", where a fictional advertisement appeared on a bus. Davies originally had three additional roles planned for Twist that would have featured in the episodes cold open. These included a nanny pushing a stroller in 1946
Pennsylvania, a blue-skinned extraterrestrial working in an alien diner as a waitress who would have served the Doctor and Ruby, and a "human astronaut addressing a colony of giant ants". The scene in Pennsylvania would have also featured physicist
Albert Einstein and activist
Paul Robeson.
Lenny Rush appeared in the episode as Morris Gibbons, a scientific advisor for UNIT. Rush was originally cast to voice the character Eric in the series opening episode, "
Space Babies". However, the producers were impressed with his performance during the read-through and early days on set that they chose to recast him as Gibbons instead.
Gabriel Woolf, at the age of 91, additionally appears as the voice of Sutekh, reprising his role from
Pyramids of Mars. The remainder of the guest cast included
Genesis Lynea, Fela Lufadeju, Tachia Newall, and
Jasmine Bayes. == Broadcast and reception ==