I compile and run utilities on my Mac all the time, and I've never spent a penny on dev tools or unlocks.
Yes, there's a fee to get access to the App Store, but almost nobody on the Mac uses the App Store... the fee is mainly for putting stuff on iOS (and likely watchOS, tvOS).
The fee also gets you the absolute latest Xcode, but go back one version, and it's entirely free.
On Mac, you can install brew, and use it to install gcc, clang, qemu, whatever utilities you want.
You used to need the developer fee to put stuff on your iOS device at all, but these days you can put stuff on your personal devices without a fee, but the binary expires in a week... enough to learn and debug, but not ideal for a personal tool. That's about the only annoyance where the fee comes up... long term deployment to iOS.