On my Mac Pro (model 6,1 - the 2013 Trashcan) suddenly WiFi stopped working.
I couldn't even enable it anymore and looking in the System Preferences - Network, selecting the WiFI triggered an error.
This may happen on other models and other macOS versions as well.
It took me some time and effort to find the fix, but this worked for me:
We need to remove a few files from this directory:
It affects these files (not all may be available on your Mac):
I copied them to a backup folder on my desktop, and then deleted them from the original location.
After that reboot your Mac.
In my case, WiFi worked and right away detected and connected to my WiFi network.
This may not work for everybody, but it worked for me.