Skip to main content

Install KXBuild manually

Use these steps if the one-line installer doesn't work in your environment, you want to choose each component's version and location, or you're installing on an offline network. You end up with exactly what the script installs.

What gets installed

Every component lives under one install root, called KXBUILD_HOME below. It defaults to %USERPROFILE%\kxbuild on Windows and ~/kxbuild on Linux and macOS. You can pick another folder, but then adjust every step to match.

Component Purpose Location Installed by
kxbuild The main CLI. It drives every other component. KXBUILD_HOME/bin/ You
C++ build tools Needed to compile with the Swift toolchain and to build CocoaPods' native extensions Windows: Visual Studio C++ Build Tools. Linux: gcc, make and other system packages. macOS: Xcode Command Line Tools. You
Ruby + CocoaPods Dependency management for iOS projects KXBUILD_HOME/ruby/, or an existing system install On Windows, you install Ruby and doctor installs CocoaPods. On Linux and macOS, you install both.
Node.js ≥ 20 Only needed for React Native and Expo projects KXBUILD_HOME/node/, or an existing system install You
Swift toolchain Compiles Swift and Objective-C code. Its version must match the one the iOS SDK requires. KXBUILD_HOME/Developer/Toolchains/ (on a Mac with Xcode, Xcode's toolchain is used) You
iOS SDK and other components The iPhoneOS SDK plus tools such as xcrun, ld64.lld and clang KXBUILD_HOME/Developer/Platforms/ and nearby folders kxbuild doctor

The Swift version must be : it is the version the iOS SDK that doctor downloads in the last step was built with, and the two have to match exactly. doctor installs Apple's toolchain libraries along with the SDK, so nothing else is needed for them. If the download fails, iOS SDK explains how to put the SDK in place by hand.

Windows limits paths to 260 characters by default, so don't nest KXBUILD_HOME too deeply. The commands below assume the default %USERPROFILE%\kxbuild. Run every PowerShell command in an Administrator window.
1

Visual Studio C++ Build Tools + Windows SDK

On Windows, Swift compiles with MSVC and links against the Windows SDK, so install these first. Download them from the Visual Studio website and select "Desktop development with C++", or run:

PS> winget install --id Microsoft.VisualStudio.2022.BuildTools --override "--quiet --wait --norestart --add Microsoft.VisualStudio.Workload.VCTools --includeRecommended"

This takes 10-20 GB of disk space. If you already have Visual Studio, open the Visual Studio Installer and add the "Desktop development with C++" workload.

2

Download kxbuild

Download the archive for your architecture and put the kxbuild.exe inside it in %USERPROFILE%\kxbuild\bin\:

PS> New-Item -ItemType Directory -Force "$env:USERPROFILE\kxbuild\bin" | Out-Null PS> Expand-Archive -Force "$env:USERPROFILE\Downloads\kxbuild.zip" "$env:TEMP\kxbuild" PS> Move-Item -Force (Get-ChildItem "$env:TEMP\kxbuild" -Recurse -Filter kxbuild.exe)[0].FullName "$env:USERPROFILE\kxbuild\bin\kxbuild.exe"

The downloaded file name may include a version number, so change kxbuild.zip in the command to match. The links always point to the latest release, and the exact version doesn't matter because kxbuild doctor updates kxbuild automatically once it's installed.

3

Ruby + DevKit

CocoaPods is a Ruby gem with native extensions, so you need the version with DevKit. Download "Ruby+Devkit 3.4.x (x64)" from rubyinstaller.org, install it to %USERPROFILE%\kxbuild\ruby, then run this in PowerShell:

PS> & "$env:USERPROFILE\kxbuild\ruby\bin\ridk.cmd" install 1 3

ridk install 1 3 installs the MSYS2 base system and the MinGW build toolchain, a few hundred MB. Skip this step if you already have a Ruby with ridk. kxbuild doctor installs CocoaPods itself.

4

Node.js ≥ 20

Only React Native and Expo projects need this. If you already have node v20 or later, skip it. Otherwise download the LTS .zip (not the .msi) from nodejs.org and extract its contents to:

%USERPROFILE%\kxbuild\node\ (node.exe sits directly in this folder)

The .zip keeps your existing node untouched. If a global install is fine with you, run the .msi instead and leave node out of PATH in step 6.

5

Swift toolchain

Download the version the SDK requires (see the top of this page) from swift.org. Install it to %USERPROFILE%\kxbuild\Developer with only the NoAsserts toolchain:

PS> & "$env:USERPROFILE\Downloads\swift--RELEASE-windows10.exe" /quiet /norestart InstallRoot="$env:USERPROFILE\kxbuild\Developer" OptionsInstallAssertsToolchain=0 OptionsInstallNoAssertsToolchain=1

The download is about 1.7 GB and takes about 4.5 GB once installed. On ARM64, replace windows10 in the file name with windows10-arm64. The default +Asserts toolchain runs compiler self-checks on every build, which only slows things down, so use NoAsserts.

6

Environment variables

Set the user environment variable KXBUILD_HOME and prepend bin, node and ruby\bin to PATH:

PS> [Environment]::SetEnvironmentVariable('KXBUILD_HOME', "$env:USERPROFILE\kxbuild", 'User') PS> [Environment]::SetEnvironmentVariable('PATH', "$env:USERPROFILE\kxbuild\bin;$env:USERPROFILE\kxbuild\node;$env:USERPROFILE\kxbuild\ruby\bin;" + [Environment]::GetEnvironmentVariable('PATH', 'User'), 'User')

If you use an existing node or ruby, remove its entry from PATH. The changes take effect in a new terminal.

7

Run kxbuild doctor to install the rest

Open a new Administrator PowerShell and run:

PS> kxbuild doctor

doctor checks each of the steps above, then installs the iOS SDK from sharedcomponents and downloads CocoaPods and the remaining tools through kpm. It also turns on Windows Developer Mode and long path support, which is why it needs Administrator rights. If any step went wrong, doctor tells you which one.

Stuck during installation? Run kxbuild doctor first and see what it reports. If that doesn't help, email admin@kxbuild.net with the doctor output.