Kotlin-native without XCode?

Is it possible to use Kotlin-Native on MacOS with just the command line tools and not XCode itself installed?

I compiled the example program with the latest release but get the following error:

xcrun: error: unable to find utility "xcodebuild", not a developer tool or in PATH

exception: org.jetbrains.kotlin.konan.MissingXcodeException: An error occurred during an xcrun execution. Make sure that Xcode and its command line tools are properly installed.

clang & swiftc can work with just the command line tools. Can kotlinc-native work in the same manner?

Thanks!

2 Likes

Probably not. That is an Apple thing not Kotlin-Native. Apple pretty much insists that you have to use their lousy tools at some point.

4 Likes

I wonder how Go and GCC get away with this then.

Edit More I think about it the more I think this is Kotlin Native specific. Clang and the Swift compiler are open source so there is no secret magic that allows these programs to generate binaries w/o needing XCode. Further, Go, GCC, OCaml, Crystal and many other compilers that have nothing to do with Apple are able generate assembly on MacOS w/o depending XCode either.

1 Like

Hello, @realdoug! I can confirm that currently, one cannot use Kotlin/Native targeting Mac without the Xcode presented. Can you please clarify why this can become an obstacle to your case? This question is unusual feedback, so the team would like to know more.

Sure, thanks for clarifying. I share the same reasoning as the folks who commented here.

I think it’s one thing to require XCode be installed when developing on a Mac (though I’d prefer to not install it if I can avoid it), but when cross compiling for Mac via Windows or Linux, XCode can become quite a pain if not a hindrance.

Xcode takes lots of storage space, and Apple’s downloader sucks and so downloading Xcode on a lousy internet connection is very hard. It would be much appreciated if Kotlin Native could drop this useless dep.

1 Like

Hey, I just wanted to add on to this. The plan of my company was to use Kotlin native for our internal CLI tools, now as others said installing XCode on your device is acceptable but not satisfying. The much bigger issue being that we cannot generate our CLI tools with our CI. Is there any possibility that Kotlin native would not need XCode in the future so applications build with it could be build on a non-apple CI?

Is there any progress in this?

Our CI system has Mac Mini build agents, that have limited on-board storage (which is fine, we build on external drives)
XCode commandline tools are installed. But XCode itself isn’t as it is not needed for our builds. Don’t really understand why Kotlin Native requires XCode. Workarounds are very welcome. Not looking forward to doing an installation on external storage.