David was educated at Aberdeen Grammar School and at Marischal College, University of Aberdeen. Intending to enter the Church, he proceeded to Edinburgh University, where he studied theology under Dr Thomas Chalmers, with whom he remained friendly until the latter's death in 1847. However, abandoning his aspirations to the ministry, be returned to Aberdeen to undertake the editorship of the Banner, a weekly paper devoted to the advocacy of Free Kirk principles. After two years he resigned this post and went back to Edinburgh to pursue a purely literary career. There he wrote a great deal, contributing to Fraser's Magazine, Dublin University Magazine (in which appeared his essays on Thomas Chatterton) and other periodicals. In 1847 he went to London, where he found wider scope for his energy and knowledge.
He was secretary (1851–1852) of the "Society of the Friends of Italy." In a famous interview with Elizabeth Barrett Browning at Florence he contested her admiration for Napoleon III. He had known Thomas de Quincey, whose biography he contributed in 1878 to the "English Men of Letters" series, and he was an enthusiastic friend and admirer of Thomas Carlyle. In 1852 he was appointed professor of English literature at University College, London, in succession to A H Clough, and for some years from 1858 he edited the newly established Macmillan's Magazine. In 1865 he was selected for the chair of rhetoric and English literature at Edinburgh, and during the early years of his professorship actively promoted the movement for the university education of women. In 1879 he became editor of the Register of the Privy Council of Scotland, and in 1886 gave the Rhind Lectures on that subject.. In 1893 he was appointed Historiographer Royal for Scotland. Two years later he resigned his professorship. In 1896 he was President of the Edinburgh Sir Walter Scott Club and gave the Toast to Sir Walter at the club's annual dinner. By 1900 he was Chairman of the Scottish History Society.
When he first arrived in Edinburgh in 1865, Masson lived in Rosebery Crescent, then he lived at 10 Regent Terrace from 1869 to 1882 before moving to Great King Street. Among the friends who used to visit him were the famous philosopher John Stuart Mill and the historian Thomas Carlyle. J.M. Barrie was a student of Masson in 1878–1882, and Massie is credited with being the future dramatist's literary mentor.
A bust of Masson was presented to the senate of the University of Edinburgh in 1897. In 1900–1901 Masson is listed as living at 2 Lockharton Gardens in south-west Edinburgh (designed by Sir James Gowans). He died in Edinburgh and is buried in the north-west section of Grange Cemetery in Edinburgh next to the main north path.
David Masson married Emily Rosaline Orme in London on 17 August 1854. Their son, David Orme Masson, became the first Professor of Chemistry at the University of Melbourne, and their daughter Rosaline was known as a writer and novelist. Daughter Flora Masson was a suffragist.
His magnum opus is his Life of Milton in Connexion with the History of His Own Time in six volumes, the first of which appeared in 1858 and the last in 1880. He also edited the library edition of Milton's Poetical Works (3 vols., 1874), and De Quincey's Collected Works (14 vols., 1889–1890). Among his other publications are
- Essays, Biographical and Critical (1856, reprinted with additions, 3 vols., 1874)
- British Novelists and their Styles (1859)
- Drummond of Hawthornden (1873)
- Chatterton (1873)
- Edinburgh Sketches (1892)
- Waterston, Charles D; Macmillan Shearer, A (July 2006). Former Fellows of the Royal Society of Edinburgh 1783–2002: Biographical Index (PDF). II. Edinburgh: The Royal Society of Edinburgh. ISBN 978-0-902198-84-5. Retrieved 15 December 2011.
- Biographical Index of Former Fellows of the Royal Society of Edinburgh 1783–2002 (PDF). The Royal Society of Edinburgh. July 2006. ISBN 0 902 198 84 X.
- One or more of the preceding sentences incorporates text from a publication now in the public domain: Chisholm, Hugh, ed. (1911). . Encyclopædia Britannica. 17 (11th ed.). Cambridge University Press. p. 870.
- Mitchell , Anne (1993), "The People of Calton Hill", Mercat Press, James Thin, Edinburgh, ISBN 1-873644-18-3.
- Dunbar, Janet (1970), "J.M. Barrie: The Man Behind the Image", Houghton Mifflin Company, Boston, pp. 37-41.
- Edinburgh and Leith Post Office Directory 1900–1901
- Evidence from birth certificate of their daughter, Rosaline Masson, available in records of www.scotlandspeople.gov.uk or the General Register Office for Scotland, Scotlands People Centre in Edinburgh.
|Wikisource has original works written by or about:|