Here’s how to lock down your Mac while you’re on public Wi-Fi:
First, Launch System Preferences and go to Security & Privacy > Firewall. Make sure Firewall is on. If it isn’t, you’ll need to click the lock in the lower left and enter the admin password to enable it. When it’s on, then go to Firewall Options > Enable Stealth Mode:
Behold Stealth Mode, Yosemite Style.
Between the Firewall being on and Stealth Mode being enabled, you have done quite a bit to secure your machine. This doesn’t mean you’re 100% protected from hacking, by virtue of being online there is always some risk (at home or not), and if you’re one of those people who leaves all your stuff to go to the restroom then all bets are off.
A secondary measure you can take is to disable other broadcasting services. If you have iTunes sharing set up, you might want to turn that off in iTunes > Preferences > Sharing so your computer doesn’t magically appear in someone else’s iTunes. Another service to adjust is AirDrop. Open a new window and click on AirDrop in the sidebar, or switch to the Finder and choose Go > AirDrop. In that window, you can adjust who sees your computer if they too open an AirDrop window:
Take a good look at the AirDrop options. Everyone? Really?
You can adjust this to contacts, or even nobody at all if you’d rather disable it entirely. Now at least while you’re not home you can close some of the most obvious access points to all your information.