Skip to content

Instantly share code, notes, and snippets.

@Lessica
Last active January 16, 2024 13:30
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Lessica/c2d7bfcc3b9edb364b83387ad7785302 to your computer and use it in GitHub Desktop.
Save Lessica/c2d7bfcc3b9edb364b83387ad7785302 to your computer and use it in GitHub Desktop.
Build script for idevicerestore and all its dependencies for macOS.
#!/bin/sh
# Tested on macOS 12.0 / Xcode 13.3 / Homebrew 3.4.6-60-ge1c1157
# yum install python python-devel
# echo '[group_kdesig-cmake3_EPEL]
# name=Copr repo for cmake3_EPEL owned by @kdesig
# baseurl=https://copr-be.cloud.fedoraproject.org/results/@kdesig/cmake3_EPEL/epel-7-$basearch/
# type=rpm-md
# skip_if_unavailable=True
# gpgcheck=1
# gpgkey=https://copr-be.cloud.fedoraproject.org/results/@kdesig/cmake3_EPEL/pubkey.gpg
# repo_gpgcheck=0
# enabled=1
# enabled_metadata=1' >> /etc/yum.repos.d/cmake3.repo
# yum install cmake3
mkdir BuildFutureRestore
cd BuildFutureRestore
brew install make cmake automake autoconf libtool pkg-config curl openssl readline
echo 'export PKG_CONFIG_PATH="/usr/local/opt/curl/lib/pkgconfig:$PKG_CONFIG_PATH"' >> ~/.zshrc
echo 'export PKG_CONFIG_PATH="/usr/local/opt/openssl/lib/pkgconfig:$PKG_CONFIG_PATH"' >> ~/.zshrc
echo 'export PKG_CONFIG_PATH="/usr/local/opt/readline/lib/pkgconfig:$PKG_CONFIG_PATH"' >> ~/.zshrc
# echo 'export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:/usr/local/lib64/pkgconfig:$PKG_CONFIG_PATH"' >> ~/.zshrc
source ~/.zshrc
git clone https://github.com/libimobiledevice/libplist.git
cd libplist
CFLAGS="-mmacosx-version-min=11.0" ./autogen.sh --enable-static --disable-shared
sudo rm -f /usr/local/lib/libplist*
make clean
make -j8
sudo make install
ls /usr/local/lib/libplist*
cd ..
git clone --recursive https://github.com/nih-at/libzip.git
cd libzip
# CFLAGS="-mmacosx-version-min=11.0" cmake . -DBUILD_SHARED_LIBS=off -DENABLE_ZSTD=off -DENABLE_GNUTLS=off -DENABLE_MBEDTLS=off -DOPENSSL_CRYPTO_LIBRARY=$HOME/Projects/BuildVNCServer/Build-OpenSSL-cURL/archive/libcurl-7.80.0-openssl-1.1.1l-nghttp2-1.46.0/lib/MacOS/libcrypto.a -DOPENSSL_INCLUDE_DIR=$HOME/Projects/BuildVNCServer/Build-OpenSSL-cURL/archive/libcurl-7.80.0-openssl-1.1.1l-nghttp2-1.46.0/include
CFLAGS="-mmacosx-version-min=11.0" cmake . -DBUILD_SHARED_LIBS=off
# cmake3 .
# ln -s /usr/local/lib64/libzip.so.5.0 /lib64/libzip.so
# ln -s /usr/local/lib64/libzip.so.5.0 /lib64/libzip.so.5
sudo rm -f /usr/local/lib/libzip*
make clean
make -j8
sudo make install
ls /usr/local/lib/libzip*
cd ..
git clone --recursive https://github.com/tihmstar/libgeneral.git
cd libgeneral
CFLAGS="-mmacosx-version-min=11.0" ./autogen.sh --enable-static --disable-shared
sudo rm -f /usr/local/lib/libgeneral*
make clean
make -j8
sudo make install
ls /usr/local/lib/libgeneral*
cd ..
git clone --recursive https://github.com/libimobiledevice/libimobiledevice-glue.git
cd libimobiledevice-glue
CFLAGS="-mmacosx-version-min=11.0" ./autogen.sh --enable-static --disable-shared
sudo rm -f /usr/local/lib/libimobiledevice-glue*
make clean
make -j8
sudo make install
ls /usr/local/lib/libimobiledevice-glue*
cd ..
git clone --recursive https://github.com/tihmstar/libfragmentzip.git
cd libfragmentzip
CFLAGS="-mmacosx-version-min=11.0" ./autogen.sh --enable-static --disable-shared
sudo rm -f /usr/local/lib/libfragmentzip*
make clean
make -j8
sudo make install
ls /usr/local/lib/libfragmentzip*
cd ..
git clone --recursive https://github.com/libimobiledevice/libirecovery.git
cd libirecovery
CFLAGS="-mmacosx-version-min=11.0" ./autogen.sh --enable-static --disable-shared
sudo rm -f /usr/local/lib/libirecovery*
make clean
make -j8
sudo make install
ls /usr/local/lib/libirecovery*
cd ..
git clone --recursive https://github.com/tihmstar/tsschecker.git
cd tsschecker
# CFLAGS="-mmacosx-version-min=11.0" LDFLAGS="-L$HOME/Projects/BuildVNCServer/Build-OpenSSL-cURL/archive/libcurl-7.80.0-openssl-1.1.1l-nghttp2-1.46.0/lib/MacOS -lnghttp2 -framework SystemConfiguration -framework Security" ./autogen.sh --enable-static --disable-shared
CFLAGS="-mmacosx-version-min=11.0" ./autogen.sh --enable-static --disable-shared
sudo rm -f /usr/local/bin/tsschecker
make clean
make -j8
sudo make install
otool -L /usr/local/bin/tsschecker
cd ..
git clone --recursive https://github.com/tihmstar/img4tool.git
cd img4tool
CFLAGS="-mmacosx-version-min=11.0" ./autogen.sh --enable-static --disable-shared
sudo rm -f /usr/local/bin/img4tool
make clean
make -j8
sudo make install
otool -L /usr/local/bin/img4tool
cd ..
git clone --recursive https://github.com/libimobiledevice/libusbmuxd.git
cd libusbmuxd
CFLAGS="-mmacosx-version-min=11.0" ./autogen.sh --enable-static --disable-shared
sudo rm -f /usr/local/lib/libusbmuxd*
make clean
make -j8
sudo make install
ls /usr/local/lib/libusbmuxd*
cd ..
git clone --recursive https://github.com/libimobiledevice/libimobiledevice.git
cd libimobiledevice
CFLAGS="-mmacosx-version-min=11.0" ./autogen.sh --enable-static --disable-shared
# sudo rm -f /usr/local/lib/libimobiledevice*
make clean
make -j8
sudo make install
ls /usr/local/lib/libimobiledevice*
cd ..
git clone --recursive https://github.com/libusb/libusb.git
cd libusb
CFLAGS="-mmacosx-version-min=11.0" LDFLAGS="-framework CoreFoundation -framework Security -framework IOKit" ./autogen.sh --enable-static --disable-shared
# sudo rm -f /usr/local/lib/libusb*
make clean
make -j8
sudo make install
ls /usr/local/lib/libusb*
cd ..
git clone --recursive https://github.com/libimobiledevice/usbmuxd.git
cd usbmuxd
CFLAGS="-mmacosx-version-min=11.0" LDFLAGS="-framework CoreFoundation -framework Security -framework IOKit" ./autogen.sh --enable-static --disable-shared
sudo rm -f /usr/local/sbin/usbmuxd
make clean
make -j8
sudo make install
otool -L /usr/local/sbin/usbmuxd
cd ..
# ln -s /usr/local/lib/pkgconfig/libplist-2.0.pc /usr/local/lib/pkgconfig/libplist.pc
# ln -s /usr/local/lib/pkgconfig/libplist++-2.0.pc /usr/local/lib/pkgconfig/libplist++.pc
# ln -s /usr/local/lib/pkgconfig/libirecovery-1.0.pc /usr/local/lib/pkgconfig/libirecovery.pc
# ln -s /usr/local/lib/pkgconfig/libusbmuxd-2.0.pc /usr/local/lib/pkgconfig/libusbmuxd.pc
# ln -s /usr/local/lib/pkgconfig/libimobiledevice-glue-1.0.pc /usr/local/lib/pkgconfig/libimobiledevice-glue.pc
# ln -s /usr/local/lib/pkgconfig/libimobiledevice-1.0.pc /usr/local/lib/pkgconfig/libimobiledevice.pc
# echo 'export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH"' >> ~/.zshrc
# source ~/.zshrc
git clone --recursive https://github.com/tihmstar/idevicerestore.git
cd idevicerestore
CFLAGS="-mmacosx-version-min=11.0" LDFLAGS="-L$HOME/Projects/BuildVNCServer/Build-OpenSSL-cURL/archive/libcurl-7.80.0-openssl-1.1.1l-nghttp2-1.46.0/lib/MacOS -lnghttp2 -llzma -lbz2 -framework SystemConfiguration -framework Security" ./autogen.sh --enable-static --disable-shared
make clean
make -j8
sudo make install
cd ..
@Lessica
Copy link
Author

Lessica commented Nov 7, 2019

This bash script will install futurerestore from its source. By default, install prefix is /usr/local.

@Lessica
Copy link
Author

Lessica commented Nov 7, 2019

On CentOS 7, you need to uncomment some lines and make some changes.

@Lessica
Copy link
Author

Lessica commented Nov 7, 2019

This gist is for the lazy ones who would like to build the latest futurerestore and all its dependencies before Apple stops signing old firmwares, SEPs and BBs.

@Bios597407
Copy link

how to jailbreak 2018 macbook , please

@XboxOneSogie720
Copy link

@Bios597407 You don't jailbreak Macs

@Lessica
Copy link
Author

Lessica commented May 13, 2023

This script is deprecated. See another gist: https://gist.github.com/Lessica/97c3ee0172bf8e24820b71dfe44d53b3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment