The year his father died, Hamilton moved from Athlone to attend the Royal School, Armagh, along with Rev. Arthur Grueber who became headmaster that year. He went to Trinity College, Dublin in 1765, developing interests in astronomy and science, and graduated with a B.A. in 1769.[2][6]
He married Jane Bunbury, probably sometime between 1770 and 1780 (union unrecorded). The couple had two daughters: Harriet, who was married c.1797 to Peter Holmes, and Jane, who was married in 1800 to Alexander Holmes.[6][2] They also had two wards, Catherine and Juliana Tisdall.[5]
In February 1784, he resigned from Kildress and was rector of Dunbin for a short time before becoming treasurer of the Diocese of Armagh and rector of Creggan. The same year he gained bachelor and doctor of divinity degrees at Trinity. In the late 1780s, under the fortuitous patronage of Archbishop Richard Robinson, Anglican Primate of All Ireland, Baron Rokeby and 3rd Baronet Rokeby, he began establishing an observatory at Armagh. An equatorial transit instrument was purchased from Edward Troughton of London. He resigned the treasurership of Armagh in March 1790 and took on the prebendary of Tynan. In December, he relinquished that role for the prebendary of Mullabrack and the archdeaconry of Ross. On 31 July, he was appointed astronomer and keeper of the new Armagh Observatory and museum. The observatory was established by an act of Parliament.[8] In this process, he was supported throughout by Maskelyne.[6][9][10]
The observatory building bears a plaque stating that Hamilton commenced the post in 1793; his first recorded observation - with a transit instrument - was on 18 July 1793. His scientific patron, Archbishop Robinson, with whom he appeared to spend much time in Bath, died in 1794, so the stream of funds for commissioning equipment for the observatory was blocked by the board of trustees. Nonetheless, a 42-inch (107 cm) focal length refractor by Dollond was acquired, a 10-foot Newtonian reflector by Herschel, outstanding clocks by Thomas Earnshaw in particular and Dublin-based John Crosthwaite, and a comparatively inferior transit instrument by local horologist James Waugh. Hamilton provided references for Earnshaw's fine work which led to the latter being awarded a share of the 'longitude prize', the principal recipient being the great John Harrison.[7] Amid difficulties operating the equipment, and with the help of his assistants, most notably Presbyterian minister Robert Hogg, a routine of observations was established but they were regarded as reliable if not notable in astronomical circles.[6][10][11][12] He made a number of entries in The Transactions of the Royal Irish Academy concerning his astronomical observations at Armagh and Greenwich and the usage of associated equipment. He successfully maintained his desire to work with other astronomers and observatories, especially Dunsink Observatory in Dublin, and to continue with Robinson's wish for a permanent scientific and educational institution in the north of Ireland, even using his own funds.[13][5]
In 1800 he published An Astronomical Introduction to the Study of Geography for usage in schools.[14] In September 1804, Hamilton was appointed dean of Cloyne, his final and most senior ecclesiastical post. He remained in his post at Armagh Observatory until his death there, on 21 November 1815, aged 66. He was buried at Mullabrack.[6][10]