How many years should a Mac last? That depends on your needs. Apple typically provides the latest Mac operating system for 5-7 years after a Mac is originally released (which may be earlier than the year you purchased it). Apple's latest system, Ventura, supports most Macs released in 2017 and later. You must be running the latest version of MacOS to receive bug fixes and improvements for your Mac's built-in apps, and to receive Apple's quickest and most comprehensive security updates.
Once Apple stops providing the latest operating system for your Mac, they continue to provide basic security updates for an additional 2 years (7-9 years after the original release date of the Mac). Most common apps like Microsoft Office will continue to be supported during this time period.
For aging Macs that are 10+ years old, there are no guarantees around updates or compatibility. Apple has a track record of occasionally releasing updates for especially egregious security problems plaguing older systems, but makes no promises. Many 3rd party apps no longer work. Apple may not provide an option to repair these older systems. Web browsers such as Chrome, Safari, and Firefox may stop receiving updates, making web browsing difficult and less secure.
Practically, most folks end up upgrading within 5-9 years after the original release date of their Mac either because they prefer to be on the latest MacOS operating system, for security reasons, because they want a faster computer, to ensure they are compatible with apps like Microsoft Office, or because their computer stopped working or had reliability issues.
Jensen Gelfond is the Founder of Asheville Digital Lifestyle. He helps people use their technology more effectively and joyfully.