I had the same despite Xcode being installed. It happened because I hadn’t accepted the Apple Developer Program License Agreement in the [Apple Developer Portal][1]
If you login into the portal with your Apple username and password you should see this:
PS You won’t see this message if you don’t have a Apple Developer Program membership (You need one to be able to build for MacOS/iOS)