Dunlop was born on 28 December 1868 in Kilmarnock as the only child of Alexander Dunlop and Catherine Nicol (1847–1873). His father was an architect and a Quaker preacher. He lost his mother at the age of five and was brought up by his grandfather on the Isle of Arran, where he learnt the trade of fishing. After his grandfather died in turn, he returned to his father in Kilmarnock once again, attending the local school. On completing his schooling, he did an apprenticeship with an engineering company in Ardrossan, Ayrshire in western Scotland.