Red pixels on Mojave and Catalina Dark Mode I purchased a new MacBook Pro 15 (2017) and immediately installed Mojave. I then started to see red pixels appearing on the same line as the top menubar. It happens very rarely, but has already occurred about 4 times per week. Pixels disappear if you move any window. I noticed this while using Firefox and iTerm.

Could it be an issue with hardware (dead pixels) or software (Mojave dark theme)?
Update:
This bug is potentially fixed in macOS 11 Big Sur. The bug report I filed is now marked as:

Potential fix identified - In macOS 11

One commenter, Curtis Hard, has stated the issue no longer happens for them with Big Sur.
It's unclear if the fix will be backported to 10.15 or 10.14.

It's definitely not a dead-pixel issue. I've determined it's probably a software bug introduced in Mojave and still present in Catalina. I'm not able to screenshot the glitch in most cases (the glitch will typically immediately disappear), but I have managed to capture it on a couple of videos and screenshots.
The fact that it can be captured in software and the fact that the cursor can cover over the glitched pixels indicates the issue is not in the screen but happening in software.
Examples:
Firefox
Here's a screenshot from a screen recording of Firefox, where you can see the grey pixels.

Interestingly, if we zoom in a bit, we can see the pixels are actually outside the window itself.

Finder
I've also captured similar glitches happening in Apple's own Finder on regular screenshots.


Notes:
Some interesting things to note about it.

I've only seen it happen against dark areas of a window.
It can happen in both light mode and dark mode (if the window is dark anyway).
It mostly happens at the edge of a window (where the shadow is), though I have seen it on the inside of some.
It often (but not always) disappears when window focus changes, among other things (window focus changing causes window shadows to change).

I've been able to change focus to and from an iTerm window with no shadow (when transparency is enabled), and the glitch outside the bottom edge of the window persisted.


It can be captured with QuickTime Player's Screen Recording feature.
Mysteriously, though it can be capture with QuickTime, it is invisible to Apple's developer tool Pixie, as seen in this screen recording. Likewise, the Digital Color Meter app does not see it either.
I've seen it mostly in grey and red, but also green, yellow, and more colors.
The glitch can happen even when Finder is not running, so it's not a part of Finder.
Running killall Dock while SSH'd into a machine displaying the glitch may cause it to stop, though this may just be a side-effect of shadow changes.
I tried suspending all the Firefox processes (firefox + plugin-container processes) over SSH with kill -SIGSTOP while the glitch was happening and the glitch continued to blink, further indicating the glitch is happening outside the Firefox processes.
Going further, I tried systematically suspending processes over SSH, to see which one might be responsible. The only one suspending causes the flashing to freeze with was WindowServer.
Using the Quartz Debug developer tool (one of the Xcode addition tools, mentioned here), I tested some of the options it had. When the &quot;Disable 2D Acceleration&quot; option was enabled, I was unable to reproduce the glitch like I could when it was disabled. The Autoflush drawing and Vertical Sync options had no effect.
It seems to only happen with the integrated graphics card. I have not been able to reproduce it while the discrete card is active.
So far I've only heard reports of it happening on recent MacBook Pro and MacBook Air models. I was unable to reproduce this issue on a previous generation MacBook Air running the same OS version.
I've not yet seen it happen in a Mojave VM using VMware Fusion, further indicating it only happens with certain hardware.
To remove all variables, I tried running a clean install of Mojave 10.14.1 on an external drive. With all default settings, I was quickly able to reproduce it Light Mode with Firefox 63.0.1 with the dark theme and dark developer tools theme enabled and the console open (screen recording).
Browser-like applications appear especially likely to trigger it (ie. Firefox and Electron-based apps).
Applications I've seen it with (I've probably forgotten some):

Firefox (especially versions &lt; 70)

Top edge (requires dark Firefox theme)
Bottom edge (requires dark bottom of window from open search bar with dark theme, dev tools with dark theme, or dark web page content). Also done on a clean 10.14.1 install.


Atom (may require Settings &gt; Core &gt; Title Bar &gt; custom)

Top edge
Bottom edge


Discord

Bottom edge
Inside window


iTerm (with a black, semi-transparent background; it does not seem to happen with an opaque background)

Top edge
Bottom edge
Inside window (at the bottom edge of one pane with split panes)


Finder

Top edge
Inside window (tab bar)


Activity Monitor

Top edge


Disk Utility

Top edge


Console

Inside window (over the transparent column headers)


Mail

Inside window (over the transparent column headers)


Archive Utility

Top edge


Hex Fiend

Top edge


Google Chrome (when using macOS dark mode)

Inside window at chrome://downloads/ under light grey horizontal line of top menu bar)




I've also seen it happen once at the bottom edge of the drop-down menus from the top menu bar.
The selection of apps and places I've seen it with make me suspicious it may in some way be window transparency related.

Things that have no impact on the glitch (tested with Firefox):

Doing a clean install of 10.14.1.
Resetting PRAM.
Resetting SMC.
Open the app in low resolution mode.
System Preferences:

Display resolution scaling.
Display color profile.
Night Shift.
System accent color.
Auto-hiding dock.
Accessibility &gt; Display &gt; Use grayscale
Accessibility &gt; Display &gt; Invert colors



Hardware:
I've only heard claims of it affecting different MacBook Pro models from 2016+ and the 2018+ MacBook Air (the models with USB Type-C). If you are seeing this issue on another Apple computer model, or don't have this issue on one of the affected models, I would be interested to hear about it.
Conclusion:
Unfortunately, I don't think there is any way to prevent this glitch at this point, aside from forcing the use of the discrete card if your computer has one (and you don't mind the reduced battery life), but hopefully it will be resolved in a future update.
Even more unfortunate, it still has not been fixed in any version from 10.14.0 through 10.14.6 or the second supplemental update since, and remains unfixed in the first supplemental update for 10.15.7. A comment from Curtis Hard confirms it was still present in the Big Sur betas at the time (it would be great if someone could confirm or deny it exists in newer builds).
I filed a bug report on bugreport.apple.com (not public, but 46079638), which has been marked as a duplicate of 45841204. I don't have access to that bug report, but thought I would mention it in case anyone wants to reference it.
On a side note, there's a good change Apple's future ARM-based computers won't have this issue since they won't have the Intel integrated GPU's. That won't fix the issue for existing Intel computers though.
Firefox 70+:
Since Firefox 70 it doesn't happen as often as it did before, though it still does happen. I suspect this is related to some improvements that reduce the amount of screen drawing.

Steps to reproduce:
I've had the best luck reproducing the bug with Firefox.

Open Firefox (63.0.1 in my case)
Set Firefox theme to Dark

View &gt; Toolbars &gt; Customize... &gt; Themes &gt; Dark


Navigate to a page like http://example.com/
Open developer tools

Tools &gt; Web Developer &gt; Inspector


Set developer tools theme to dark

In the top right, click ... &gt; Settings &gt; Themes &gt; Dark


Click the Inspector tab
Open the console

In the top right, click ... &gt; Show Split Console


Ensure the developer tools covers the bottom of the window

If it doesn't, in the top right, click ... &gt; Dock to Bottom


Reload the page until the glitch happens

References:

Bugzilla: Colored Artifacts Appear Above Tab Bar with OS X Mojave in Dark Mode
MacRumors: Weird Issue Red pixels on Mojave Dark Mode
Reddit: Red dot blinking between the head bar and the firefox window on Mac.[...]
Reddit: Anyone else dealing with screen glitches on Mojave?
Reddit: MBP15 2018 Intel GPU artifact
Reddit: Flickering pixels above Firefox title bar — macOS
Reddit: Graphic Glitches when watch Netflix, anyone know about this?

Possibly loosely related: Avoid using a transparent surface by using CoreAnimation (if my suspicion that it is transparency related is correct, that change may eventually have an impact on this bug happening with Firefox, if only by avoiding the OS bug).
Note: If you have any info to share but don't have an account here, you can contact me here.