Skip to content

Uninstall And Manual Cleanup

Use the packaged Patronus uninstaller first. The manual commands below are recovery steps for cases where the app, helper, or an E2E test exits before it restores the local proxy or removes the local CA.

Run the packaged uninstaller from the Patronus install folder when it is available:

Terminal window
& "$env:LOCALAPPDATA\Programs\Patronus Desktop\Uninstall Patronus.cmd"

If Windows still shows proxy errors after uninstall, open PowerShell as Administrator and run:

Terminal window
$internetSettings = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings"
Set-ItemProperty -Path $internetSettings -Name ProxyEnable -Value 0 -Type DWord
Remove-ItemProperty -Path $internetSettings -Name ProxyServer -ErrorAction SilentlyContinue
Remove-ItemProperty -Path $internetSettings -Name ProxyOverride -ErrorAction SilentlyContinue
Remove-ItemProperty -Path $internetSettings -Name AutoConfigURL -ErrorAction SilentlyContinue
netsh winhttp reset proxy
ipconfig /flushdns

Stop leftover Patronus and mitmproxy processes if they are still running:

Terminal window
foreach ($name in @(
"patronus-helper.exe",
"patronus-wfp-redirector.exe",
"patronus-redirector.exe",
"proxy-sidecar.exe",
"mitmdump.exe",
"mitmproxy.exe"
)) {
taskkill /F /T /IM $name 2>$null
}

Remove Patronus/mitmproxy CA trust entries:

Terminal window
$thumbprints = @()
foreach ($file in @(
"$env:USERPROFILE\.mitmproxy\mitmproxy-ca-cert.cer",
"$env:USERPROFILE\.mitmproxy\mitmproxy-ca-cert.pem",
"$env:USERPROFILE\.mitmproxy\mitmproxy-ca.pem"
)) {
if (Test-Path $file) {
try { $thumbprints += ([System.Security.Cryptography.X509Certificates.X509Certificate2]::new($file)).Thumbprint } catch {}
}
}
Get-ChildItem Cert:\CurrentUser\Root,Cert:\LocalMachine\Root -ErrorAction SilentlyContinue |
Where-Object {
$thumbprints -contains $_.Thumbprint -or
$_.Subject -match "(?i)\bmitmproxy\b" -or
$_.Issuer -match "(?i)\bmitmproxy\b"
} |
Remove-Item -Force

Remove runtime CA and proxy environment values:

Terminal window
foreach ($name in @(
"NODE_EXTRA_CA_CERTS",
"SSL_CERT_FILE",
"REQUESTS_CA_BUNDLE",
"CURL_CA_BUNDLE",
"PIP_CERT",
"HTTP_PROXY",
"HTTPS_PROXY",
"ALL_PROXY",
"http_proxy",
"https_proxy",
"all_proxy",
"NODE_USE_ENV_PROXY"
)) {
[Environment]::SetEnvironmentVariable($name, $null, "User")
[Environment]::SetEnvironmentVariable($name, $null, "Machine")
Remove-Item "Env:\$name" -ErrorAction SilentlyContinue
}

Remove local mitmproxy CA files if Patronus was the only app using them:

Terminal window
Remove-Item "$env:USERPROFILE\.mitmproxy\patronus-ca-bundle.pem" -Force -ErrorAction SilentlyContinue
Remove-Item "$env:USERPROFILE\.mitmproxy\mitmproxy-ca-cert.cer" -Force -ErrorAction SilentlyContinue
Remove-Item "$env:USERPROFILE\.mitmproxy\mitmproxy-ca-cert.pem" -Force -ErrorAction SilentlyContinue
Remove-Item "$env:USERPROFILE\.mitmproxy\mitmproxy-ca.pem" -Force -ErrorAction SilentlyContinue
Remove-Item "$env:USERPROFILE\.mitmproxy\mitmproxy-ca.p12" -Force -ErrorAction SilentlyContinue

Open a new terminal window after changing environment values.

Run the packaged uninstaller when it is available:

Terminal window
open "/Applications/Uninstall Patronus.app"

If only the script is present:

Terminal window
sudo "/Applications/.uninstall_patronus_system.sh" --remove-apps --remove-mitmproxy-files

If network access still fails after uninstall, reset manual proxy settings for all network services:

Terminal window
while IFS= read -r service; do
[ -z "$service" ] && continue
sudo networksetup -setwebproxystate "$service" off
sudo networksetup -setsecurewebproxystate "$service" off
sudo networksetup -setsocksfirewallproxystate "$service" off
sudo networksetup -setautoproxystate "$service" off
done < <(networksetup -listallnetworkservices | tail -n +2 | sed 's/^\*//')

Stop leftover Patronus and mitmproxy processes if they are still running:

Terminal window
pkill -x "Patronus Desktop" || true
pkill -x "Patronus" || true
pkill -x "proxy-sidecar" || true
pkill -x "rendezvous-sidecar" || true
pkill -x "mitmdump" || true
pkill -x "mitmproxy" || true

Remove the mitmproxy CA from macOS keychains:

Terminal window
sudo security delete-certificate -c "mitmproxy" /Library/Keychains/System.keychain || true
security delete-certificate -c "mitmproxy" "$HOME/Library/Keychains/login.keychain-db" || true

Remove runtime CA and proxy environment values from the current launch session:

Terminal window
for name in NODE_EXTRA_CA_CERTS SSL_CERT_FILE REQUESTS_CA_BUNDLE CURL_CA_BUNDLE PIP_CERT HTTP_PROXY HTTPS_PROXY ALL_PROXY http_proxy https_proxy all_proxy NODE_USE_ENV_PROXY; do
launchctl unsetenv "$name" || true
done

Remove Patronus shell profile blocks:

Terminal window
for file in "$HOME/.zshrc" "$HOME/.zprofile" "$HOME/.bash_profile" "$HOME/.bashrc" "$HOME/.profile"; do
[ -f "$file" ] || continue
perl -0pi -e 's/# Added by Patronus Node CA \(begin\).*?# Added by Patronus Node CA \(end\)\n?//gs' "$file"
perl -0pi -e 's/# Added by Patronus Python CA \(begin\).*?# Added by Patronus Python CA \(end\)\n?//gs' "$file"
done

Remove the Patronus proxy env source file and references from shell profiles:

Terminal window
proxy_env_file="$HOME/Library/Logs/com.patronus.desktop/patronus_proxy_env.sh"
for file in "$HOME/.zshrc" "$HOME/.zprofile" "$HOME/.bash_profile" "$HOME/.bashrc" "$HOME/.profile"; do
[ -f "$file" ] || continue
PATRONUS_PROXY_ENV_FILE="$proxy_env_file" perl -ni -e 'print unless index($_, $ENV{PATRONUS_PROXY_ENV_FILE}) >= 0' "$file"
done
rm -f "$proxy_env_file"

Remove local mitmproxy CA files if Patronus was the only app using them:

Terminal window
rm -f "$HOME/.mitmproxy/patronus-ca-bundle.pem"
rm -f "$HOME/.mitmproxy/mitmproxy-ca-cert.cer"
rm -f "$HOME/.mitmproxy/mitmproxy-ca-cert.pem"
rm -f "$HOME/.mitmproxy/mitmproxy-ca.pem"
rm -f "$HOME/.mitmproxy/mitmproxy-ca.p12"

Flush DNS after changing proxy settings:

Terminal window
sudo dscacheutil -flushcache
sudo killall -HUP mDNSResponder

Restart open terminal sessions after changing launch or shell environment values.