I've had one die (would not start up) after 8 years or so, if I recall correctly. The problem arises when the Operating System is no longer supported/updated to correct security flaws. Of course, if the Operating System has been around and updated for some number of years and it still has security flaws, perhaps our prior comfort level was just an illusion...as is much of life.
Macs can be expected to last more than ten years, the only problem being that after 11-12 years, Apple is likely to come up with an update that won't be compatible with the older machines. Then, you're left with a computer that works as well as it has been working, but you won't be able to upgrade the OS and some of the programs that you have paid for, plus you won't be able to acquire new programs as they will be geared to the newer OS. Macs do sometimes crash, but I've never had one go bad on me in less than eleven years, and, even then, they might be fixable, but, if they're obsolete as far as the OS is concerned, I'm not inclined to pay for them to be fixed. After my last MacBook became obsolete, I was still able to sell it for more than a lot of Windows PCs cost new. I don't know how long Windows PCs last these days, but the ones I've had only lasted a few years.