A common cause of adware these days is nefarious browser pop-ups. You’re on a webpage, let’s say, and you get a notice that you need to update Adobe Flash. You click through the prompts to install it (because you’re a good little Apple user, and you always stay up to date!), and suddenly, you’ve got a new homepage. Or your search page looks weird. Yup, you’ve got adware. I walked through some tips for removing it here, but to avoid it in the future, know that it’s always best to check for updates to Flash, for example, through System Preferences rather than trusting that a browser pop-up you’ve seen is legitimate.
So if you’ve gotten one of those Flash pop-ups, close out of it (without agreeing to install anything, force-quitting your browser if necessary!), and then head on over to System Preferences to check if what you saw was real.
When you get there, look for “Flash Player” near the bottom of the window.
Click that, and within that pane, you’ll see an “Updates” tab.
Under that tab, there are two buttons at the bottom; the NPAPI plug-in is the one that Safari uses, and PPAPI is the one for Chrome. It’s all right not to have both of them installed, but for whichever ones you do, click “Check Now” to find out whether you’ve got any legitimate updates available.
If your machine does need an update, you’ll be asked whether you’d like to download and install it, and then you’ll walk through some pretty typical steps to do so—click “Install Now” on Adobe’s page, wait for it to download, then double-click it from Safari’s “Downloads” toolbar icon and follow the prompts afterward.
But this way, you’ll know for sure that what you’re getting is actually from Adobe and not from HorribleAnnoyingBrowserAdware.com. Unless you really like NSFW pop-ups randomly appearing, in which case…well…more power to you, I guess!