Barrie was born in Kirriemuir, Angus, to a conservative Scottish Calvinist family. His father David Barrie was a modestly successful weaver. His mother Margaret Ogilvy Barrie had assumed her deceased mother's household responsibilities at the age of 8. Barrie was the ninth child of ten (two of whom died before he was born), all of whom were schooled in at least the three Rs, in preparation for possible professional careers. He was a small child (he would grow to only about 5 feet as an adult), and drew attention to himself with storytelling.
When he was 6 years old, his next-older brother David Barrie , his mother's favourite, died two days before his 14th birthday in an ice-skating accident. This left his mother devastated, and Barrie tried to fill David's place in his mother's attentions, even wearing his clothes. One time Barrie entered her room, and heard her say "Is that you?" "I thought it was the dead boy she was speaking to," wrote Barrie in his biographical account of his mother, Margaret Ogilvy (1896), "and I said in a little lonely voice, 'No, it's no' him, it's just me.'" Barrie's mother found comfort in the fact that her dead son would remain a boy forever, never to grow up and leave her. It has been speculated that this trauma induced psychogenic dwarfism, and was responsible for his short stature and apparently asexual adulthood. Eventually Barrie and his mother entertained each other with stories of her brief childhood and books such as Robinson Crusoe and Pilgrim's Progress.
At the age of 8, Barrie was sent to the Glasgow Academy, in the care of his eldest siblings Alexander and Mary Ann, who taught at the school. When he was 10 he returned home and continued his education at the Forfar Academy. At 13, he left home for Dumfries Academy, again under the watch of Alexander and Mary Ann. He became a voracious reader, and was fond of penny dreadfuls, and the works of Robert Michael Ballantyne and James Fenimore Cooper. At Dumfries he and his friends spent time in the garden of Moat Brae house, playing pirates "in a sort of Odyssey that was long afterwards to become the play of Peter Pan". They formed a drama club, producing his first play Bandelero the Bandit, which provoked a minor controversy following a scathing moral denunciation from a clergyman on the school's governing board.
Barrie wished to pursue a career as an author, but was persuaded by his family – who wished him to have a profession such as the ministry – to enroll at the University of Edinburgh, where he wrote drama reviews for a local newspaper. He worked for a year and a half as a staff journalist in Nottingham, then returned to Kirriemuir, using his mother's stories about the town (which he called "Thrums") for a piece submitted to a paper in London. The editor "liked that Scotch thing", so Barrie wrote a series of them, which served as the basis for his first novels: Auld Licht Idylls (1888), A Window in Thrums (1890), and The Little Minister (1891). Literary criticism of these early works has been unfavourable, tending to disparage them as sentimental and nostalgic depictions of a parochial Scotland far from the realities of the industrialised nineteenth century, but they were popular enough to establish Barrie as a very successful writer. His two "Tommy" novels, Sentimental Tommy (1896) and Tommy and Grizel (1902), were about a boy and young man who clings to childish fantasy, with an unhappy ending.
Meanwhile, Barrie's attention turned increasingly to works for the theatre, beginning with a biography about Richard Savage (performed only once, and critically panned). He immediately followed this with Ibsen's Ghost (1891), a parody of Henrik Ibsen's drama Ghosts; unlicensed in the UK until 1914, it had created a sensation at the time from a single 'club' performance. The production of Barrie's play at Toole's Theatre in London was seen by William Archer, the translator of Ibsen's works into English, who enjoyed the humour of the play and recommended it to others. Barrie also authored Jane Annie, a failed comic opera for Richard D'Oyly Carte (1893), which he begged his friend Arthur Conan Doyle to revise and finish for him. In 1901 and 1902 he had back-to-back successes: Quality Street, about a responsible "old maid" who poses as her flirtatious "niece" to win the attention of a former suitor returned from the war; and The Admirable Crichton, a critically-acclaimed social commentary with elaborate staging, about an aristocratic household shipwrecked on a desert island, in which the butler naturally rises to leadership over his lord and ladies for the duration of their time away from civilisation.
The first appearance of Peter Pan came in The Little White Bird, which was serialized in the United States, then published in a single volume in the UK in 1901. Barrie's most famous and enduring work, Peter Pan, or The Boy Who Wouldn't Grow Up, had its first stage performance on 27 December, 1904. It has been performed innumerable times since then, was developed by Barrie into the 1911 novel Peter and Wendy, and has been adapted by others into feature films, musicals, and more. The Bloomsbury scenes show the societal constraints of late Victorian middle-class domestic reality, contrasted with Neverland, a world where morality is ambivalent. George Bernard Shaw's description of the play as "ostensibly a holiday entertainment for children but really a play for grown-up people", suggests deeper social allegories at work in Peter Pan. In 1929 Barrie specified that the copyright of the Peter Pan works should go to the nation's leading children's hospital, Great Ormond Street Hospital in London. The current status of the copyright is somewhat complex.
Barrie had a long string of successes on the stage after Peter Pan, many of which discuss social concerns. The Twelve Pound Look shows a wife divorcing a peer and gaining an independent income. Other plays, such as Mary Rose and a subplot in Dear Brutus revisit the image of the ageless child. Later plays included What Every Woman Knows (1908). His final play was The Boy David (1936), which dramatized the Biblical story of King Saul and the young David. Like the role of Peter Pan, that of David was played by a woman, Elisabeth Bergner, for whom Barrie wrote the play.
Barrie used his considerable income to help finance the production of commercially unsuccessful stage productions. Along with a number of other playwrights, he was involved in the 1909 and 1911 attempts to challenge the censorship of the theatre by the Lord Chamberlain.
Barrie founded a cricket team for his friends. Conan Doyle, Wells, and other luminaries such as Jerome K. Jerome, G. K. Chesterton, A. A. Milne, Walter Raleigh, A. E. W. Mason, E. V. Lucas, Maurice Hewlett, E. W. Hornung, P. G. Wodehouse, Owen Seaman, Bernard Partridge, Augustine Birrell, Paul du Chaillu, and the son of Alfred Tennyson played at various times. The team were called the "Allahakbarries", under the mistaken belief that "Allah akbar" meant "Heaven help us" in Arabic (rather than "God is great").
Barrie befriended Africa explorer Joseph Thomson and Antarctica explorer Robert Falcon Scott. He was godfather to Scott's son Peter, and was one of the seven people to whom Scott wrote letters in the final hours of his life following his successful – but doomed – expedition to the South Pole.
Barrie's close friend Charles Frohman, who was responsible for producing the debut of Peter Pan in both England and the U.S. and other productions of Barrie's plays, famously declined a lifeboat seat when the RMS Lusitania was sunk by a German U-boat in the North Atlantic, reportedly paraphrasing Peter Pan's famous line from the stage play, "To die will be an awfully big adventure."
The Arthur Llewelyn Davies family played an important part in Barrie's literary and personal life. It consisted of the parents Arthur (1863–1907) and Sylvia, née du Maurier (1866–1910) (daughter of George du Maurier), ; and their five sons George (1893–1915), John (Jack) (1894-1959), Peter (1897–1960), Michael (1900–1921), and Nicholas (Nico) (1903–1980).
Barrie became acquainted with the family in 1897, meeting George and Jack (and baby Peter) with their nurse (i.e. nanny) Mary Hodgson in London's Kensington Gardens. He lived nearby and often walked his Landseer Newfoundland dog Porthos in the park, and entertained the boys regularly with his ability to wiggle his ears and eyebrows, and his stories. He did not meet Sylvia until a chance encounter at a dinner party in December. He became a regular visitor at the Davies household and a common companion to the woman and her boys, despite the fact that he and she were each married. When Arthur Llewelyn Davies died in 1907, "Uncle Jim" became even more involved with the Davies, and provided financial support to them. (His income from Peter Pan and other works was easily adequate to provide for their living expenses and education.) Following Sylvia's death in 1910, Barrie claimed that they had been engaged to be married. Her will indicated nothing to that effect, but specified her wish for "J.M.B." to be trustee and guardian to the boys, along with her mother Emma, her brother Guy Du Maurier, and Arthur's brother Compton. It expressed her confidence in Barrie as the boys' caretaker and her wish for "the boys to treat him (& their uncles) with absolute confidence & straightforwardness & to talk to him about everything." When copying the will informally for Sylvia's family a few months later, Barrie inserted himself in an additional paragraph: Sylvia had written that she would like Mary Hodgson, the boys' nurse, to continue taking care of them, and for "Jenny" (Mary's sister) to come help her; Barrie instead wrote "Jimmy" (Sylvia's nickname for him). Although Barrie and Hodgson did not get along well, they served as surrogate parents until the boys were all in school and Jack was married.
Barrie also had friendships with other children, both before he met the Davies boys and after they were grown, and there have often been suspicions that Barrie was a paedophile or engaged in child sexual abuse. However, there is no evidence that Barrie did – or was accused at the time of doing – anything of that sort. Nico, the youngest of the brothers, flatly denied that Barrie ever behaved inappropriately. "I don't believe that Uncle Jim ever experienced what one might call 'a stirring in the undergrowth' for anyone — man, woman, or child," he stated. "He was an innocent — which is why he could write Peter Pan." His relationships with the Davies boys continued well beyond their childhood and adolescence.
The statue of Peter Pan in Kensington Gardens, erected in secret overnight for May Morning in 1912, was supposed to be modelled upon old photographs of Michael dressed as Peter Pan. However, the sculptor decided to use a different child as a model, leaving Barrie very disappointed with the result. "It doesn't show the devil in Peter", he said.
Barrie suffered bereavements with the boys, losing the two to whom he was closest. George was killed in action (1915) in World War I. Michael, with whom Barrie corresponded daily, drowned (1921) with his friend and possible lover Rupert Buxton, at a known danger spot at Sandford Lock near Oxford, one month short of his 21st birthday. Some years after Barrie's death, Peter wrote his Morgue, which contains much family information and comments on Barrie.
In 1978 the BBC made an award-winning miniseries written by Andrew Birkin, The Lost Boys, starring Ian Holm as Barrie and 0068029 as Sylvia. It is considered highly factual, includes Arthur Llewelyn Davies (0683116), and briefly addresses the issue of Barrie's affection for the Davies boys. The set of 2 DVDs is available in both the UK and USA. Birkin also published J.M. Barrie and the Lost Boys, a factual book covering in greater detail the material portrayed in the docudrama.
A semi-fictional movie about his relationship with the family, Finding Neverland, was released in November 2004, starring Johnny Depp as Barrie and Kate Winslet as Sylvia Llewelyn Davies. It takes liberties with the facts, alters the sequence of some events (e.g. Sylvia is already a widow when she meets Barrie), and omits Nico altogether.