After attending Cambridge University, Farnie returned to his native Scotland, where he was appointed editor of the Cupar Gazette. In 1857, he wrote The Golfer's Manual, the first book on golf instruction. In 1860, he wrote books on the flora of St. Andrews and on The City of St. Rule. His journalism career brought him to London in 1863 as editor of a new musical journal, The Orchestra. He began to write the lyrics to popular songs, and, in 1867, he began to write plays. During the 1870s and 1880s, Farnie turned out translations and adaptations of dozens of French operas and operettas. Many of the latter had long and successful runs. Among his few enduring lyrics is the "Gendarmes' Duet", adapted from Offenbach's Geneviève de Brabant.
Farnie was born in Burntisland, Fife, Scotland, one of seven children of James Farnie and the former Margaret Paterson Cairns. He was named after the Whig statesman Lord Brougham, to whom the family claimed to be related. Farnie was educated at St. Andrews University, where he won a prize that took him to Cambridge University. After leaving Cambridge, he returned to Scotland, where he was appointed editor of the Cupar Gazette. In 1857, Farnie wrote the first book on golf instruction, The Golfer's Manual: being an historical and descriptive account of the national game of Scotland, under the pseudonym, "A Keen Hand". He also wrote the Handy book of St. Andrews about the flora of that area of Scotland, and The City of St. Rule with calotypes by Thomas Rodger (1860).
In 1863 Farnie moved to London, as editor of a new musical journal, The Orchestra. In the first edition of the magazine, he printed one of his own verses, "The Last Stirrup Cup", which impressed the composer Luigi Arditi so much that he set it to music. The song was taken up by Charles Santley and became immensely popular. The Morning Post stated that it was familiar to "millions of people". The Era later wrote, "the success of this casual attempt at song writing determined Farnie's future career." The proprietors of The Orchestra, the musical publishers Cramer and Co, engaged Farnie as their literary adviser, with a brief to adapt and translate foreign operas. Simultaneously, Farnie found himself in demand as the lyricist for popular songs. Among the songs for which he wrote lyrics were, "The Guards' Song" (music by Dan Godfrey), "Land Ho" (music by Henry Leslie), "The Message from the Battlefield" (music by John Hullah), "The Dove and the Maiden" (music by Jacques Offenbach), "The Fall of the Leaf" (music by George Macfarren), and "Summer is Nigh" (music by Julius Benedict).
In 1867, Farnie's two-act drama Reverses was staged at the Strand Theatre. The Observer, in a favourable review, said of Farnie, "if he has not before this tried his hand at dramatic writing, he has at all events now made a very successful essay in the art." His principal work for the stage, however, was as a librettist. He wrote or adapted libretti for dozens of operettas in the 1870s and 1880s. Although many of Farnie's adaptations were extremely popular and enjoyed long and profitable runs in West End theatres, most of them did not survive beyond his lifetime. One obituary said of them, "few were of very high literary merit. They were furnished chiefly to suit ephemeral public taste, and for the most part ceased to exist with the excitement they created." According to a 1914 article in The Times, the translations were heavy-handed, and "The spoken dialogue was a kind of Sahara between the oases of song ... the attempts to fit English words to French music usually resulted in absolute nonsense." Even harsher was the judgment of The Pall Mall Gazette: "He had little or no original talent or literary faculty, but an immense knack of vamping up French opera bouffes, glozing over licentiousness sufficiently to get it smuggled past the censor, spicing the dialogue with 'topical allusions,' and converting the lyrics into some sort of patter that would go with the music. The dogerel [sic] he used to produce was something appalling." Nevertheless, some of Farnie's lyrics have endured, including the "Gendarmes' Duet" (adapted from Offenbach's Geneviève de Brabant), and "Sweet Dreamer" (with Arthur Sullivan).
Among Farnie's earliest adaptations were operas by Gounod: La reine de Saba, (which Farnie renamed Irene),Ulysse and The Pet Dove. Farnie later prepared Gounod's Roméo et Juliette for its first British performance in English, given after his death by the Carl Rosa Opera Company in 1890. Farnie's other adaptations include the English libretti for Offenbach's Breaking the Spell (Le violoneux) (1870; later played as a companion piece with The Sorcerer), Geneviève de Brabant (1871), Barbe-bleue (1872, Bluebeard), Fleur de Lys, with music by Leo Delibes (based on La cour du roi Pétaud), starring Selina Dolaro and Emily Soldene (1873), a version of Dick Whittington and His Cat with music by Offenbach (1875), The Rose of Auvergne, or, Spoiling the Broth, The Barber of Bath, La fille du tambour-major, the very successful Madame Favart (1879), and The Blind Beggars (1882); for Robert Planquette's hit debut, Les cloches de Corneville (1878) and his Rip van Winkle (1882), Nell Gwynne (1884), Les voltigeurs de la 32ème (The Light Infantrymen of the 32nd Regiment) (1887), and Paul Jones (1889); for Edmond Audran's Olivette (1880; another hit), La mascotte (1881) and The Grand Mogul (1884, starring Florence St. John, Fred Leslie and Arthur Roberts); for Charles Lecocq's La fille de Madame Angot (1873); for Richard Genée's The Naval Cadets (1880); for Franz von Suppé's Boccaccio (1882); for Francis Chassaigne's Falka (1883); and for Hervé's Little Faust! (1870) and Chilpéric (1884). With Englishman Edward Solomon, Farnie wrote Rothomago or The Magic Watch in 1879. With William Marshall Hutchison, he wrote Glamour in 1886.
Farnie wrote some original libretti, including Nemesis; The Bride of Song, a one-act opera with music by Julius Benedict; and The Sleeping Queen for Thomas German Reed, with music by Balfe. He collaborated with Robert Reece on 15 of his libretti or adaptations, including Up the River, or the Strict Kew-Tea (1877), Stars and Garters (1878), Les cloches de Corneville (1878) and The Creole, all at the Folly Theatre, London (where Farnie also acted as stage manager), and Boccaccio. At least one of Farnie's libretti was set by two different composers. His Nell Gwynne, a three-act opera, was first set by Alfred Cellier and was staged at the Prince's Theatre in Manchester, where it opened on 17 October 1876 for a run of 24 performances. Later, Robert Planquette set Farnie's libretto, and that version was staged at the Avenue Theatre in London on 7 February 1884 before transferring to the Comedy Theatre for a total of 86 performances. The Planquette version also ran for 38 performances at the Casino Theatre in New York in November the same year. Farnie's shows that were performed on Broadway as well as in London include: Sinbad the Sailor (1869), Pluto (1869), The Forty Thieves (1870), Little Faust (1870, revived 1871), Bluebeard (1872), Nemesis Not Wisely But Too Well (1874), Indiana (1887), and Nell Gwynne (1901).
Farnie married Elizabeth Bebb Davies, of Wales, in 1861, but the couple lived in Scotland. She divorced him for adultery after a few years, and he then married Alethea Emma Harvey, an Englishwoman, in 1865. In 1879, his second wife, also complaining of adultery and cruelty, petitioned the English courts for a declaration that their marriage was null and void. The case made legal history: Harvey's argument was that since the first marriage was solemnised in England, the courts in Scotland did not have the power to end that marriage by divorce, and therefore, Farnie had not been free to marry Harvey. The Lords found that the divorce decree of the Scottish courts should be respected by the English courts.
Farnie died suddenly at the age of 53 in Paris. He left his entire estate of £23,072 to his sister, Isabella.