I had the same problem on my Mac, and after fixing it I have figured out that it was caused by FortiClient (VPN client). Even when FortiClient was disconnected - it's DNS still appeared in the scutil.
The solution for me was:
scutil
> list ".*DNS"
This will show you a list of all DNS configs, that will look something like:
subKey [0] = State:/Network/Global/DNS <br>
subKey [1] = State:/Network/MulticastDNS<br>
subKey [2] = State:/Network/OpenVPN/DNS<br>
subKey [3] = State:/Network/OpenVPN/OldDNS<br>
subKey [4] = State:/Network/PrivateDNS<br>
subKey [5] = State:/Network/Service/forticlientsslvpn/DNS <br>
To check each of them run: (until you find the problematic one)
> get key_name
> d.show
…and to fix it run:
> get key_name
> d.remove ServerAddresses
> set key_name
This is how it looked on my machine:
> get State:/Network/Service/forticlientsslvpn/DNS
> d.show
<dictionary> {
ServerAddresses : <array> {
0 : 192.168.30.6
1 : 192.168.30.15
}
SupplementalMatchDomains : <array> {
0 :
}
SupplementalMatchOrders : <array> {
0 : 100000
}
}
> d.remove ServerAddresses
> d.show
<dictionary> {
SupplementalMatchDomains : <array> {
0 :
}
SupplementalMatchOrders : <array> {
0 : 100000
}
}
> set State:/Network/Service/forticlientsslvpn/DNS
> exit
In the .terminal file, RunCommandAsShell
should not be set to <true/>
.
This correlates to the "Run inside shell" checkbox in the "Shell" section of the preference window; which is more intuitively named.
When the preference is not selected (RunCommandAsShell
is true), then the default shell is replaced with whatever command you've used. If the preference is selected (RunCommandAsShell
is either false or not listed in the .terminal file), then the command is run after the default shell is loaded for that Terminal window/tab.
Best Answer
You can edit
~/Library/Preferences/com.apple.LaunchServices.plist
(~/Library/Preferences/com.apple.LaunchServices/com.apple.launchservices.secure.plist
on Catalina) in a text editor after converting it to XML:Then add entries like this to the
LSHandlers
array:You can use
mdls
to see the UTIs of file types and something likeosascript -e 'id of app "AppName"'
to see the bundle identifiers of applications.You can apply changes to
com.apple.LaunchServices.plist
by restarting. Logging out and back in isn't enough.I also use duti though. I have saved a file like this (with about 100 lines) as
~/.duti
:I have a launchd agent that runs
duti ~/.duti
automatically when~/.duti
is changed.You can normally use filename extensions (like
.jpg
) instead of a UTIs (likepublic.jpg
) to specify file types.duti
converts the extensions to UTIs that also apply to other extensions (like.jpeg
). For some extensions like.mkv
and.tex
, the UTI depends on what application registered the extension first.The latest version of
duti
only includes source code, but 1.5.0 also includes an installer.