VIDEO: How to Detect Spyware on macOS Using Terminal (Part 2)
When your Mac starts acting like it’s keeping secrets, it might be time to dig deeper. Here’s how to use Terminal to inspect network connections.
You open your MacBook one morning, and the fan kicks on loudly. Nothing’s open. No video rendering, no browser tabs going wild. You check Activity Monitor, nothing obvious.
Then you notice your battery drains faster than usual, and your internet usage spikes even when you’re not online. It could be a glitch, sure. But it could also be something more invasive, like spyware silently watching from the shadows, siphoning off data while pretending everything’s fine.
If that sounds far-fetched, don’t worry, you don’t need to be a hacker to check. With just a few Terminal commands, you can dig into your Mac’s network activity and see exactly what’s reaching out behind the scenes. Spyware often communicates with external servers. The lsof and netstat commands can show active network connections.
In this second part in the guide, learn how to spot spyware using the Terminal by inspecting network connections.

How to Detect Spyware on macOS Using Terminal By Inspecting Network Connections
Step 1: Open Terminal, go to Launchpad > Terminal
Step 2: Type lsof -i and press Enter. This command lists all open files and network connections. What to look for:
- Unexpected connections: Are there connections to IP addresses or domains you don't recognize, especially from applications that shouldn't be communicating with the internet?
- Unknown applications: Do you see applications making connections that you didn't launch or don't know the purpose of?
- Unusual ports: While many common ports exist (80, 443 for web, 22 for SSH), look for connections on obscure or non-standard ports.
Step 3: Type netstat -an and press Enter. This shows all active network connections and listening ports numerically. What to look for:
Look for "ESTABLISHED" connections to unknown foreign addresses or "LISTEN" ports that you didn't intentionally open.
Video Script & Editing: Kelechi Edeh / Techloy.com | Content Research: Ogbonda Chivumnovu / Techloy.com
Conclusion
Your Mac probably isn’t haunted, but if it’s behaving like it has a mind of its own, spyware could be the culprit. These Terminal tools let you peek behind the curtain and spot odd activity before it becomes a real problem. And if you do find something fishy? Disconnect from Wi-Fi and talk to a pro or at least start with a malware scan.


