He also pinched crisps, other food and washing detergents before making his escape, which was short-lived.
Nottinghamshire Police were on the scene within six minutes of being called and quickly found a man matching the intruder’s description nearby.
McMahon pleaded guilty to burglary and was jailed for 22 weeks.
Nottinghamshire Police’s Sergeant Karl Browne said: “A rapid response by officers on duty allowed us to catch this burglar red-handed and I’m pleased he has also been dealt with swiftly by the courts.
“Commercial burglaries are taken very seriously by the force as we understand the financial impact on businesses and the emotional impact on members of staff.
“McMahon thought he could smash his way through the roof of a supermarket and take what he wanted so I’m pleased he has now been handed a spell behind bars.”