Only a full awareness of the threats and careful online behavior can do that. Neither can anti-virus software, of course. MacOS has built-in antivirus/anti-malware protection, but if you want another means to determine if your Mac is 'infected' I would suggest that you try either Malwarebytes for Mac or EtreCheck as the means to do so. Further, system updates cannot protect you against all malware. If you are online, Mac Cleaner will update the virus database each time you run a virus check. Mac anti-virus software certainly should catch Mac malware, otherwise it's worthless. That is taken care of by the system updates, as already stated. Remember it's function is to scan documents and media for malware that may be passed onto Windoze users by email or file sharing, not to find malware that will attack Mac OS X (same if using AV software in Linux). And there's a LOT of anti-virus software in the App Store, but I wouldn't recommend any of it except for ClamXav.
To be clear, Apple does not endorse any anti-virus software. There is a big difference between approval of software for inclusion in the App Store and endorsement by Apple. There IS antivirus scan software approved by Apple (Assuming that if it's in the App Store for purchase using Apple-ID, then de facto it's approved)