Xtool: cross-platform Xcode replacement. Build iOS apps on Linux and more!

https://forums.swift.org/t/xtool-cross-platform-xcode-replacement-build-ios-apps-on-linux-and-more/79803/1

Swift Forums

Xtool: cross-platform Xcode replacement. Build iOS apps on Linux and more!

Community Showcase

packagemanagerlinux

read 4 min

kabiroberai

Hi folks! A few months ago I shared my Swift SDK for Darwin, which allows you to build iOS Swift Packages on Linux, amongst other things. I mentioned that a lot of work still needed to be done, such as handling codesigning, packaging, and bundling.

I’m super excited to share that we’ve finally reached the point where all of these things are now possible with cross-platform, open source software. Enter, xtool!github.com

GitHub – xtool-org/xtool: Cross-platform Xcode replacement. Build and deploy…

Cross-platform Xcode replacement. Build and deploy iOS apps with SwiftPM on Linux, Windows, macOS.

About

:sweat_smile:

xtool does a lot of things (because Xcode does a lot of things ) but the headline features are

:white_check_mark:

Build a SwiftPM package into an iOS app

:white_check_mark:

Sign and install iOS apps

:white_check_mark:

Interact with Apple Developer Services programmatically

This means it’s finally possible to build and deploy iOS apps from Linux and Windows (WSL). At the same time, xtool is SwiftPM-based and fully declarative, which means you can also use it to replace Xcode on macOS for building iOS software!

A screenshot of xtool being invoked from VSCode

Using xtool

I put together some DocC Articles + a DocC Tutorial on how to get started with xtool. You can find these on Swift Package Index. Gotchas

xtool is a culmination of 8 years of work around iOS app deployment (the commit history has some nuggets!) but I’m the sole developer on this project and replicating Xcode is a massive undertaking. Now that I’m ready to share the project more widely, I’d be very happy to accept external contributions to flesh out the feature set. And if you end up using xtool, please let me know!

kabiroberai

I’ve personally been using xtool on Mac hardware, where it’s still very useful in that it’s a lot more lightweight and declarative than Xcode, and for that matter when dual-booting a different OS (think Asahi Linux / Bootcamp Windows.)

xtool itself doesn’t vend any traces of the Apple SDKs / toolchains, which is why the setup process asks users to download and provide a copy of Xcode.xip themselves, and builds the iOS SDK on the spot. I’m not a lawyer but one should definitely read the license agreement and determine whether their use case in compliance — you do have to agree to it before you download Xcode.xip.

And regarding distribution: since xtool works on both Linux and macOS, if someone is wary of publishing from Linux CI (say their CI provider doesn’t guarantee that their Linux jobs will run on macOS hardware) they’re definitely free to perform the final App Store build on macOS CI instead.

KristijanZicKristijan Žic

This would be very interesting for cross platform frameworks, Flutter and Dioxus come to mind.
And for people that have been looking to develop for iOS from Linux. I hope Apple doesn’t try to end this repo but instead embraces the value of it.

Does this allow for debugging with a device as well or is it just for installing apps atm?

kabiroberai

Does this allow for debugging with a device as well or is it just for installing apps atm?

I briefly mentioned this in the gotchas section, but xtool can’t start a debugging session itself quite yet, though it’s on the roadmap. In the meantime you can use a tool like pymobiledevice3 to start a debug session on your device, and then attach to it with lldb’s remote functionality. I realize that it might not be super clear how to do this, so I might write some documentation on the pymobiledevice3 setup even before we’re able to integrate this into xtool.

Leave a comment

Design a site like this with WordPress.com
Get started