How to codesign and notarise your app for macOS 10.14 and higher

This is the link to the XCode Command Line Tools download (requires Apple ID log-in):
https://developer.apple.com/download/more/?=for%20Xcode

it includes separate files for each major version of XCode.

I’m also getting this error. I had XCode 11.x (not sure what “x” was) so expected notarising would work…
Kept getting this error about altool not being found so I decided to open XCode to check various things. XCode immediately told me an update was available: 11.3 (never using XCode, I hadn’t updated since, I presume, 11.2). Done the update. Same error.
Tried the link above (from Detlef Kahner, thanks to him) and installed the command line tools. Still getting the same error.
Now, I’m stumped…

Edit: if it happens to someone else, this page has the answer that solved this issue for me:
https://forums.developer.apple.com/thread/118045
(you have to use “sudo xcode-select -r” to reset the command line tool paths)