Dalhousie Castle is a castle in Cockpen, Midlothian, Scotland. Dalhousie Castle is situated near the town of Bonnyrigg, 8 miles (13 km) south of Edinburgh. The castle was the seat of the Earls of Dalhousie, the chieftains of Clan Ramsay.