McCartney recorded the song during the height of the tensions that marred the sessions for the White Album. On 9 August 1968, he recorded 25 takes singing and playing acoustic guitar simultaneously. Take 24 was perceived to be the best (take 2 later appeared on Anthology 3). McCartney recorded overdubs of timpani, another guitar, fingers slapping on a book and drums on 20 August, when George Martin's orchestral contributions were also added. The drums were put halfway down an uncarpeted corridor with the microphones at the far end, resulting in a bongo-like staccato sound. John Lennon did not play on the recording, but McCartney said he contributed some words to the song in India. When Lennon (who hated McCartney recording without the rest of the band) and Ringo Starr walked into the studio after McCartney had finished, "you could have cut the atmosphere with a knife", recalled engineer Ken Scott.
