John Gray, who came to Edinburgh in around 1850, was a night watchman for the Edinburgh Police, who walked his rounds in the company of a Skye Terrier called Bobby (a nickname for a police constable). John died of tuberculosis on the 15th of February, 1858, and was buried in the Greyfriars Kirkyard - the grounds of a notable Presbyterian church in Edinburgh's Old Town.
Bobby refused to leave his master's grave for long, despite the efforts of James Brown, the gardener and keeper of Greyfriars, to evict him. According to some accounts he remained on the grave even in the worst weather conditions, although others described him as staying frequently on the grave, but leaving regularly for meals (and presumably exercise and toileting) and in extreme weather. In the end, Brown gave up trying to evict the dog and provided a shelter for Bobby by placing sacking beneath two tablestones at the side of John Gray’s grave. Bobby’s fame spread, and almost every day crowds would gather at the entrance of the Kirkyard waiting for the one o'clock gun. (Since 1852, the One O'Clock Gun was fired every day except Sunday from the nearby Castle battlements, just as the time ball, on top of Nelson's Monument, falls. Both are signals to the ships in the Firth of Forth as a check on their chronometers.) At the sound of the gun, Bobby would leave the grave in the company of William Dow, a local joiner, for a meal at the same Coffee House that he had frequented with his master.
In 1867 a new bye-law required all dogs in the city to be licensed or else be destroyed. The Lord Provost of Edinburgh, Sir William Chambers, paid Bobby's licence, and presented him with a collar inscribed "Greyfriars Bobby from the Lord Provost 1867 licensed". The collar is now at the Museum of Edinburgh, in Chambers' Street. Bobby died in 1872, and a life-size bronze statue of Bobby sculptured by William Brody was unveiled in November 1873, at the junction of George IV Bridge and Candlemaker Row, opposite the entrance to Greyfriars' Kirk. By tradition, passers-by rub the nose, giving it a constant shine.
Greyfriars Kirk has an important place in Scottish history; opened in 1620, it was the first church built in Edinburgh after the Reformation. In 1638 the National Covenant, a protest against attempts by King Charles 1 to exert control over the Scottish Church, was signed in front of the pulpit of Greyfriars Kirk, and in 1679, about 1200 Covenanters were imprisoned in Greyfriars Kirkyard pending trial. The present Kirkyard contains "The Martyrs Monument" commemorating the hundred or so Covenanters who were subsequently executed. The Kirkyard is the burial place of many of these and of many other notable Scots. One of the graves is that of Duncan Ban MacIntyre (d 1812) who fought against the Jacobites in 1745, never learned to read, and sold illicit whisky in the Lawnmarket to make a living, but who is recognised as one of the most important Gaelic poets of his time. Dr Robert Lee, the minister of Greyfriars Kirk at the time, was a leader of a movement to reform worship in Presbyterian churches. He introduced to the Kirk the first post-Reformation stained glass windows, and one of the first organs in a Presbyterian Church in Scotland.