On returning to Scotland Dun settled at Edinburgh, where he spent the remainder of his life, occupied in teaching the violin, composition, and singing. He only appears as a householder in 1829, at which time he is living in a flat at 6 Howe Street in the Second New Town.[1]
He published a collection of solfeggi with an introduction on vocal expression in 1829, but his name is best known by the collections of Scottish songs which he edited. He was also the composer of two symphonies (neither of which was published), of several glees and songs, and some unimportant dance music.
He died suddenly at Edinburgh, 28 November 1853. He is buried in Dean Cemetery in western Edinburgh. The grave lies on the north wall of the original cemetery, backing onto the first northern extension.