Not sure if you can disable the DNS cache without disabling DNS completely.
To stop and continue queries try sudo killall -STOP mDNSResponder
and sudo killall -CONT mDNSResponder
. Also not sure what layers this affects and what they might cache.
You can still flush the DNS cache easily using sudo killall -HUP mDNSResponder
so repeated calls might appear like a disabled cache. https://support.apple.com/en-us/HT202516
Use dns-sd -q apple.com
to verify this:
dns-sd -Q apple.com
DATE: ---Tue 19 Jul 2022---
15:20:11.663 ...STARTING...
Timestamp A/R Flags if Name Type Class Rdata
15:20:11.664 Add 40000002 0 apple.com. Addr IN 17.253.144.10
15:20:14.156 Rmv 0 0 apple.com. Addr IN 17.253.144.10
15:20:14.166 Add 2 0 apple.com. Addr IN 17.253.144.10
Some historical commands are now deprecated with SIP and for security.
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.mDNSResponder.plist
/System/Library/LaunchDaemons/com.apple.mDNSResponder.plist: Operation not permitted while System Integrity Protection is engaged
man mDNSResponder
sudo killall -INFO mDNSResponder
Sending SIGINFO to mDNSResponder daemon is deprecated. To trigger state dump, please use 'dns-sd -O', enter 'dns-sd -h' for more information
sudo dns-sd -O
XPC service returns error, description: State dump is only enabled in internal builds