The thing with viruses is that they’re probably the least popular form of computer attack vector these days. They’re just less common than the Windows equivalent. Macs certainly can get viruses, and Mac-specific viruses do exist. And according to antivirus vendor Malwarebytes, Mac malware has increased by 230% over 2016. More recently, the KeRanger encryption malware was distributed inside a popular BitTorrent client for macOS.
The Flashback vulnerability in Java of 2012 affected more than 500,000 Macs, so many that Apple was forced to issue a security update to OS X Lion and patch the vulnerability. Back in 2014 a hacker used the iWorm malware to create a nearly 20,000-member botnet. If the Mac was more popular, the machines would likely need more robust antivirus protection.
This has lead to a couple of insufferably smug ads from Apple on the topic, which is sort of ironic. While any computer can benefit from the protection of well-made and updated antivirus software, it’s not an essential operating requirement for Macs. This increases the likelihood that they’ll encounter a vulnerable system, improving the odds that their attack will succeed.
Without a specific target, attackers will get the greatest benefit by distributing compatible malicious code to as many computers as possible. Like spam and phishing attacks, virus distribution relies on the law of large numbers. Since Macs still represent only a sliver of market share, an enterprising hacker would get more bang for their buck by focusing on the most popular operating systems. Furthermore, macOS runs in a sand-boxed environment, making it more difficult for errant programs to take control of your system. The Unix-based macOS operating system is fundamentally different from Windows in a number of ways, meaning that any attacker hoping to infect Macs would need to create custom code tailored specifically to the operating system. The platform simply doesn’t have a large enough user base to make it worth the time for attackers to custom-build specific attack packages for the operation system’s unique features. Macs aren’t immune to viruses, but they also aren’t typically targeted by attackers. Reputable malware scanning software or antivirus software is a good addition to any secure system. And while Macs are rarely targeted by viruses, it pays to be careful. While the operating system does have some protections that can make viruses less powerful, that doesn’t mean macOS is airtight.
This is true, but not because macOS is inherently better than Windows. Apple has frequently said that Macs don’t get infected by viruses.