Mach number is a measurement of the aircraft’s speed relative to the speed of sound. Mach 1 would mean the aircraft is flying at the speed of sound and Mach .5 would mean it is flying at half the speed of sound. The mach number itself is generally determined by an air data computer gathering pitot-static and temperature data.
Mach number = True Airspeed / Local Speed of Sound
However, there are also mechanical mach indicators that work similarly to an airspeed indicator but with a more complex set of diaphragms and movement arms.
Note that the local speed of sound is not measured separately, but inferred using the altimeter capsule in the diagram. These devices can be carefully calibrated but they still depend on temperature and pressure being standard. That is why there is always some amount of error in getting the correct mach number from a mechanical system.