A myth has long persisted that macs cannot be affected by viruses in the same way that Windows PC’s are. Although macs are less commonly affected by viruses this does not mean they cannot or will never get a virus.
OSX in apple fashion is generally quite a locked down infrastructure with restrictions on what applications can be used and which ones can’t. Apple’s Gatekeeper software restricts any applications run on a mac to that which has been sourced from the apple store or which has been signed with apples specific key.
Not only do apple have restricted apps which run on the macs themselves but also whenever an application is downloaded it is scanned by XProtext apples virus scanner which will check if the code of an app looks malicious and warns the user before it is run, or even stops the file from being run in the first place.
All these protective mechanisms cannot stop all malware and although they will be generally effective an attacker is advanced enough will have no issue bypassing these mechanisms.
What can viruses on a mac do?
Viruses on a mac which is able to bypass these mechanisms is able to do anything that it would be able to do an a windows computer, steal passwords, credit cards, edit files or even hold the files to ransom just like that which was seen in the Wannacry attacks on windows PC’s in 2017.
Why you are less likely to get a virus on a mac
Although macs can still get viruses this does not mean that they get as many. Its speculated that the people who create viruses are more likely to make a virus to cause the largest impact that it can Be this holding the most amount of peoples files to ransom or to steal the credentials on the computer.
Windows holds around a 75% market share which means that the amount of users which can be attacked is much larger and the opportunity for infection responds in kind.
Because of this the chance of finding a virus specifically for mac in the wild is reduced. As always when downloading anything online only use trusted sources and use some form of anti virus software to ensure that even if something land on your computer its caught quickly.