"reset my OS X to factory setting" means (to me) erasing the hard drive, and restoring/installing the OS X system.
That, by default, means that you lose everything that is not backed up, such as your pictures, music, personal files, and applications that you have added to your Mac.
You end up with a fresh system, which boots to a new user setup, similar to a brand new Mac out of the box.
Is that what you want to do?
Tell us which Mac you have, and what version of OS X is installed now.
Which model Mac do you have?
Easy way is to look in About this Mac, under the Apple menu. There's a lot of identifying info there.
You can also click on the System Report button, then post the Model Identifier.
It will be something like "MacBookPro10,2", or "iMac13,1", or similar.
A FIRST step that you can take that may help your browser popups on a Mac would be to download and run Malwarebytes.
It's simple, safe, and will find the occasional adware that may find you occasionally. I run it once or twice a week (only takes a few seconds to scan), and it gets a hit may twice a year.
How did your run of Malwarebytes turn out?
Was any malware reported? It will delete that for you, too. That may be all you need to do.
If you still have performance issues, a simple reinstall of the system can often help.
After you drag it to Applications, go to Applications and double click on MalWareBytes in the Applications folder.
Right-click on the icon of your hard drive and select Get-Info. How big is your drive and how much space is shown as "available"? If your drive is almost full, that can cause problems.
Open Disk Utility, click on Macintosh HD in the upper left and run Verify Disk. Does it show any errors?
Please report back here on both matters.
Also as suggested by DeltaMac download and run Malwarebytes and report back here with the results.
Go into System Preference > Security and Privacy
Click on the lock at the bottom left to unlock it.
Click on the check mark to allow applications downloaded from "anywhere".
Then try opening MalwareBytes.
Then go back to system preferences and change back the settings to the way they were.
You don't even need to install Malwarebytes in Applications to use it. Just download the app then double click the DMG to open it. Then right click on the app inside the DMG and select "open" and you will get a warning and a place to click to open the app. See if that works.So I changed it to "anywhere", but still MalwareBytes not opening.
Thanks to all who helped me here. I reinstalled to factory setting and now it works fine, although my OS X downgraded from Yosemite to Mavericks, anyway it works fine. The only problem is I need to set up my Canon MP 240. Which driver download link would you suggest? Thank you.