Fixing adb server version (41) doesn't match this client (40); in Unity

Earlier Unity suddenly started to refuse building and running on my Android phone. The error message was this:

* failed to start daemon
error: cannot connect to daemon

UnityEditor.Android.CommandInvokationFailure: Unable to list connected devices. 
/Applications/Unity/Hub/Editor/2019.4.18f1/PlaybackEngines/AndroidPlayer/SDK/platform-tools/adb devices

stderr[
adb server version (41) doesn't match this client (40); killing...
ADB server didn't ACK
Full server startup log: /var/folders/ym/2b7pw1yn0v71ybqwb07t4vw00000gn/T//adb.501.log
Server had pid: 43718
--- adb starting (pid 43718) ---

What happened is the platform-tools installed by Unity and the one that got installed with Android Studio was different.

So when I ran adb devices manually in the terminal, it ran a different version of the daemon. The fix was to kill the one I had in, then restart Unity.