Mac Book Setup
MacBook Survival Guide for Linux/Windows Engineers
A practical cheat sheet for staying productive on macOS while keeping your Ubuntu/Windows muscle memory intact.
Modifier Keys: The Only Thing That Matters
macOS uses different modifier keys:
⌘ Command → Your new Ctrl
⌥ Option → Your new Alt
⌃ Control → Rarely used (right‑click)
⇧ Shift → Same as everywhere
Common shortcuts
Copy: ⌘C
Paste: ⌘V
Find: ⌘F
Close tab: ⌘W
Switch apps: ⌘Tab
Switch windows of same app: `⌘\`` (backtick)
Make macOS Feel Like Ubuntu
Terminal Install iTerm2 and core CLI tools:
brew install --cask iterm2
brew install git tmux ripgrep fd fzf wget curl
Optional shell upgrades:
brew install starship
brew install zsh-autosuggestions zsh-syntax-highlighting
Enable Starship:
eval "$(starship init zsh)"
Window Management (Windows‑Style Snapping)
Install Rectangle:
brew install --cask rectangle
Useful shortcuts:
Left half: ⌥⌘←
Right half: ⌥⌘→
Maximise: ⌥⌘↑
Make macOS behave more like Windows Alt‑Tab
If you want true Alt‑Tab behaviour (all windows, all apps), install:
brew install --cask alt-tab
Essential Developer Tools
Homebrew (package manager) Install:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Languages & Tools
brew install node python go ruby
brew install docker docker-compose
brew install kubectl k9s
brew install --cask visual-studio-code
Kubernetes Tools
brew install kubectx
brew install helm
brew install minikube
Homebrew Package Management
List installed packages
brew list
brew list --cask
Search for a package
brew search <name>
Show available versions
brew info <package>
This displays:
Installed version
Latest version
Dependencies
Whether it’s a cask or formula
The tap it comes from
Upgrade everything
brew update
brew upgrade
Remove a package
brew uninstall <package>
Clean old versions
brew cleanup
Homebrew Repository (Tap) Management
Homebrew supports additional repositories (“taps”).
List taps
brew tap
Add a tap
brew tap <user/repo>
Example:
brew tap homebrew/cask-fonts
Remove a tap
brew untap <user/repo>
Samsung Fold + Mac: Hands‑Free Integration
macOS doesn’t have Phone Link, but these work well:
Intel Unison (best overall)
brew install --cask intel-unison
Features:
Notifications
Calls
SMS
File transfer
Photos
KDE Connect (Linux‑style integration) Code
brew install --cask kdeconnect
Install KDE Connect on your Samsung Fold too.
Google Messages for Web For SMS only:
https://messages.google.com/web
Music Player (Phone + USB Workflow)
VLC (best all‑rounder)
Code
brew install --cask vlc Handles:
USB drives
Local files
Network streams
No iTunes lock‑in
USB Drive Support macOS supports:
exFAT
FAT32
NTFS (read‑only)
For NTFS write support:
brew install ntfs-3g
Phone → Mac audio Bluetooth
USB‑C audio (Fold supports it)
Smart Switch mode for file transfer
Optional: Make the Keyboard Feel Like Linux
Swap Caps Lock → Ctrl System Settings → Keyboard → Modifier Keys
Full remapping with Karabiner‑Elements
brew install --cask karabiner-elements
System Monitoring on macOS
macOS is UNIX under the hood, so most Linux commands work the same. A few tools have BSD‑style differences, but nothing that will trip you up.
Memory Usage
top
Sort by memory:
top -o mem
Sort by CPU:
top -o cpu
htop
Install:
brew install htop
Run:
htop
vm_stat
macOS‑specific memory stats:
vm_stat
Logging on macOS
macOS uses the unified logging system, plus classic BSD logs.
Unified Logging
Show recent errors:
log show --predicate 'eventMessage contains "error"' --last 1h
Live tail:
log stream
Filter by process:
log stream --process Safari
Classic Logs
Located in:
Code /var/log/ Tail system log:
sudo tail -f /var/log/system.log
Network Debugging
ifconfig
ifconfig
netstat
netstat -an | grep LISTEN
lsof (best for port usage)
List all listening ports:
sudo lsof -iTCP -sTCP:LISTEN -n -P
Find what is using a specific port:
sudo lsof -i :8080
nc (netcat)
Test connectivity:
nc -vz 192.168.1.10 5432
ping / traceroute
ping google.com
traceroute google.com
Install mtr:
brew install mtr
Firewall Testing
macOS uses an application firewall.
Check firewall status
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --getglobalstate
List allowed/blocked apps
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --listapps
Test inbound ports
From another machine:
nc -vz <mac-ip> 22
From the Mac:
sudo lsof -iTCP -sTCP:LISTEN -n -P
Port Usage
List all listening ports:
sudo lsof -iTCP -sTCP:LISTEN -n -P
netstat alternative:
netstat -an | grep LISTEN
Find what is using a specific port:
sudo lsof -i :3000
Packet Capture
tcpdump (built‑in)
Capture HTTPS traffic:
sudo tcpdump -i en0 port 443
Write to file:
sudo tcpdump -i en0 -w capture.pcap
Wireshark
Install:
brew install --cask wireshark
The Only Commands You Need for Ports, PIDs, Services, Logs
This is written so you can paste it straight into your wiki.
a) Check if a port is open
Test from the same machine (local)
sudo lsof -i :PORT
Example:
sudo lsof -i :3000
If nothing prints → nothing is listening.
Test from another machine Using nc (best)
nc -vz <ip> <port>
Example:
nc -vz 192.168.1.50 5432
Using telnet (old but works)
telnet <ip> <port>
b) Get PID for a port
This is the one you’ll use constantly.
sudo lsof -i :PORT
Example:
sudo lsof -i :5173
Output includes:
PID
Process name
User
Then kill it:
kill -9 <pid>
c) List services
macOS (launchd) List all services:
brew services list
System services:
launchctl list
Linux (systemd)
systemctl list-units --type=service
d) Restart a service
macOS (Homebrew services)
brew services restart <service>
Example:
brew services restart postgresql
Linux (systemd)
sudo systemctl restart <service>
e) Get / tail logs for a service
macOS unified logs Live stream:
log stream --process <name>
Example:
log stream --process nginx
macOS classic logs
sudo tail -f /var/log/system.log
Linux systemd logs
journalctl -u <service> -f
Example:
journalctl -u nginx -f
Bonus: The 5‑Command Mental Model
You only need to remember these:
1. Check port
sudo lsof -i :PORT
2. Test port from outside
nc -vz ip port
3. Kill process
kill -9 PID
4. Restart service
brew services restart name # macOS
systemctl restart name # Linux
5. Tail logs
log stream --process name # macOS
journalctl -u name -f # Linux
That’s it. You never need to remember netstat -tulnp again.