Depending on how much you need from the machine (data, mail, etc), the safest way to proceed is to disconnect from any ethernet connections, then stop WiFi and Bluetooth. At that point your machine is unreachable unless your ex has physical access. Once isolated, if it's ML, reboot into the rescue partition, wipe the hard drive and reinstall OSX. If it's not ML, reinstall OSX from the original disks after wiping the HD clean. (If you reinstall from the rescue partition, you'll have to reconnect to the Internet, as that process requires you to download ML from Apple. In any case, at the end of reinstall you'll have a clean system, reset to factory fresh. Follow chas_m's advice and use a strong password for all admin accounts. Turn on the Apple firewall (chas_m may disagree, but that's another topic) and then change all of your passwords on all accounts to something really strong. Frankly, I would not reload any of my old stuff unless absolutely certain it's clean, but that would be up to you.
There is a program called Little Snitch that can monitor what traffic is coming to and from your Mac, but unless you know what should and shouldn't have access, it can be difficult to use effectively.
On the iPhone and iCloud, the advice is about the same. Reset the iPhone to factory, change the iCloud password (after you have a clean machine to use to do that, otherwise a keylogger may just report to him your new password).
What I have suggested is pretty drastic, as you'll lose all of your personal data, but given that you are concerned about him, and if he has done this he's pretty creepy, it may be an acceptable price to pay to be secure.
If you aren't feeling tech-savvy sufficient to doing all of this, and if there is an Apple store nearby, you could try scheduling an appointment and have them restore the machine to factory conditions. Again, you'll lose your personal data.