Shell Objective-C C
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Building the Toolchain (Modified version from wiki page)

Toolchain for firmware 3.1.3

Checkout and get the files

First create a project directory and check out the latest copy of the toolchain builder. For Example:

mkdir -p ~/Projects/iphone/
cd ~/Projects/iphone/toolchain
git clone git://

You will need to download the iPhone SDK 3.1.3 from Apple, which can be found here:

You can also choose to download the 3.1.3 firmware from Apple at this stage. If you do not, the script will download the firmware automatically.

You can now copy the SDK and Firmware (if you have it) to the toolchain builder's directory:

cd ~/Projects/iphone/toolchain
mkdir -p files/firmware
mv /path/to/iphone_sdk_3.1.3_with_xcode_3.2.1__snow_leopard__10m2003a.dmg files/
mv /path/to/iPhone1,2_3.1.3_7E18_Restore.ipsw files/firmware

Packages needed to compile the toolchain

Here we provide a list of packages for Debian/Ubuntu

sudo apt-get install \
  automake \
  bison \
  cpio \
  flex \
  g++ \
  gawk \
  gcc \
  git \
  gobjc \
  gobjc++ \
  gzip \
  libbz2-dev \
  libcurl4-openssl-dev \
  libssl-dev  \
  make \
  mount \
  subversion \
  sudo \
  tar \
  unzip \
  uuid \
  uuid-dev \
  wget \
  xml2 \
  libxml2-dev \
  zlib1g-dev \

NOTE: if your linux distribution does not have "xar" available, you can download the source and build it yourself.

tar zxvf xar-1.5.2.tar.gz
cd xar-1.5.2
sudo make install

If you are on 64 bit please install:

sudo apt-get install g++-multilib gcc--multilib gobjc-multilib gobjc++-multilib

Startup and build

Now the environment is set up, you can start the script with:

sudo ./ all

After all steps, the toolchain is in ./toolchain with the binaries in ./toolchain/pre/bin and the system in ./toolchain/sys/ After a rebuild you may get patch warnings/errors. Ignore them because the build tries to patch already patched files.

With the newest version of the script you can control the behaviour and the filesystem places of the toolchain file with environment vars:

  Build the binaries (gcc, otool etc.) in this dir.
  Default: $TOOLCHAIN/bld

  Create the ./bin ./lib dir for the toolchain executables
  under the prefix.
  Default: $TOOLCHAIN/pre

  Store the sources (gcc etc.) in this dir.
  Default: $TOOLCHAIN/src

  Put the toolchain sys files (the iphone root system) under this dir.
  Default: $TOOLCHAIN/sys


sudo BUILD_DIR="/tmp/bld" SRC_DIR="/tmp/src" PREFIX="/usr/local" SYS_DIR=/usr/local/iphone_sdk_3.x ./ all