Have you ever needed to measure how many pixels long something on your screen is? macOS makes it very easy with the built-in screenshot tools.
You can select a region of the screen by pressing Command–Shift–4 and then holding the cursor pressed while dragging it around. Without releasing the cursor, it makes for a convenient screen ruler that can be opened quickly up at any time. By releasing it you will take a screenshot or you can dismiss it by pressing the Escape key.
There are a bunch of third-party dedicated screen ruler applications. These don’t work in OS X’s full-screen mode, many cause problems with high-resolution Retina screens, and tend to be hard to use as they’ve too many features. These apps are priced at 22 euros on average in the Mac App Store. Using the method I’ve described, however, will work on any Mac out of the box, is free of charge, and don’t have any of the issues the other apps have.
Getting up close
You can zoom in on any area of the screen—even while using the screenshot utility—by holding the Control key and scrolling (wheel or finger gesture). This must first be enabled through the System Preferences: Accessibility: Zoom: Use scroll gesture with modifier keys to zoom setting. After enabling it, you can zoom up close on the area of the screen where the cursor is resting.
The screenshot/selection tool and the zoom tool together allowing for some high precious work. Neat when you need to check if something is vertically and horizontally aligned in your designs.
This method isn’t suited for counting the distance between two points on the screen in pixels. There’s a little pixel counter next to the cursor while dragging. However, it can be hard to position it exactly between the two points. When you need exact measurements, select the region and click to take a screenshot instead of dismissing the tool. The file will be created on your Desktop. Open it in Preview where you can drag, select, and then drag again to reposition the selection. This will allow you to do more precise alignments and measurements x.
Keep in mind that these rulers will measure in device pixels.