ONE Jailbreak Ad
Research Updated Apr 05, 2024

How to compile libSandy

Promotion image of How to compile libSandy article.

libSandy is a developer library designed to enhance the sandboxing capabilities of apps, system processes, and custom modifications on jailbroken iOS devices in a secure manner. Through the utilization of sandbox APIs (refer to sandbox.h), any process gains the ability to generate extension tokens, each uniquely identifying the specific privileges it grants. These tokens, represented as strings, can then be seamlessly utilized by other processes to apply the corresponding extensions to their own operations.

This library serves as a cornerstone for several outstanding open-source theos tweaks, such as Flora, SafariPlus, Shadow, Kayoko, LetMeBlock, and AlbumManager. These jailbreak tweaks necessitate the inclusion of libSandy during compilation, with certain files needing to be relocated to the theos folder for those interested in building them from the source.

While compiling libSandy is a relatively straightforward process, newcomers to iOS theos tweak compilation might encounter errors when executing the 'make' command. Simply searching for solutions online may not yield the desired results. However, this article is designed to guide you through each step, providing a comprehensive tutorial on compiling libSandy specifically tailored for modern rootless jailbreaks including Dopamine and Palera1n.

Screenshot of libSandy build process in terminal app.

How to build libSandy for theos

To successfully compile libSandy, you need to utilize the iOS 16.2 SDK provided by Xcode 14.2. Attempting to compile libSandy with a later version of Xcode will result in a failure.

To compile a libSandy for theos, follow the steps:

Step 1. Install theos on your PC, Mac, or iOS device following our guide.

Step 2. Install iPhoneOS16.2.sdk by downloading Xcode 14.2 directly from Apple servers. You will need to authenticate with your Apple ID to download.

Step 3. Open the terminal app and extract Xcode_14.2.xip with the following command. After extraction, rename the app to not conflict with your primary installation of Xcode.

xip -x Xcode_14.2.xip

Step 4. Move Xcode_14.2.app to the Applications folder.

Step 5. Change your selected Xcode command line tools version. The following command will temporarily change your command line tools version for just this terminal session.

export DEVELOPER_DIR=/Applications/Xcode_14.2.app/Contents/Developer

or permanent

sudo xcode-select -switch /Applications/Xcode_14.2.app/Contents/Developer

If you need to use the latest Xcode toolchain from the command line, use --reset:

sudo xcode-select --reset

Step 6. Download mac-headers and copy the xpc folder to theos/include.

git clone https://github.com/realthunder/mac-headers/
cd mac-headers
cp -r "/usr/include/xpc" "$THEOS/include"

Step 7. Clone the libSandy repository from GitHub to your computer.

git clone https://github.com/opa334/libSandy

Step 8. Open the libSandy folder.

cd libSandy

Step 9. Compile libSandy following the 'make' command and install it to theos.

chmod +x ./install_to_theos.sh && chmod +x ./install_to_theos.sh

or manually...

make clean
make FINALPACKAGE=1

Step 10. Copy the generated libsandy.dylib into theos lib folder.

cp -Rv "./.theos/obj/libsandy.dylib" "$THEOS/lib"

Step 11. Compile the libSandy for rootless tweaks.

make clean 
make FINALPACKAGE=1 THEOS_PACKAGE_SCHEME=rootless

Step 12. Copy the generated libsandy.dylib rootless into theos folder.

cp -Rv "./.theos/obj/libsandy.dylib" "$THEOS/lib/iphone/rootless"

Step 13. Copy libSandy.h to the include folder located inside theos folder.

cp -v "./libSandy.h" "$THEOS/include"

Common libSandy compilation errors

One of the main hurdles faced when compiling libSandy for theos arises from using an incompatible version of Xcode. For instance, Xcode 15 typically includes the latest release of the iPhone iOS SDK, like iPhoneOS17.2.sdk. However, libSandy requires compilation using iPhoneOS16.2.sdk. If the incorrect iOS SDK version is used, errors may occur.

Screenshot of libSandy compilation errors.

  • libSandy.m:3:9: fatal error: 'xpc/xpc.h' file not found.
  • /libSandy/.theos/obj/armv7/libSandy.m.50b5a432.o] Error 1.
  • Building for iOS 8.0, but the current toolchain can’t produce arm64e binaries for iOS earlier than 14.0.
  • Error: Your chosen SDK, “iPhoneOS16.2.sdk”, does not appear to exist.

Post a comment

Latest Posts

How to install Mitsuha Forever

How to install Mitsuha tweak on iOS 15 – iOS 16

Since 2017, Mitsuha has been available in a number of editions and variations, both official and unofficial. There are many versions of this tweak that may be installed on your iPhone. Depending on the iOS version and jailbreak that is currently...

IPA installers for iOS

Best IPA installers for iOS 16 and iOS 17

You can download games and apps on your iPhone without having to go through the App Store by utilizing IPA installer apps. These tools enable users to sign and sideload apps onto their devices. Certain IPA installers can directly install IPA files...

Downr1n

Downgrade iOS checkm8 devices with Downr1n

Downr1n, developed by Edwin Nuñez, stands as a comprehensive and free toolbox, enabling the downgrading of checkm8 devices to iOS versions 16, 15, and 14, all achieved without the need for blobs. This tool facilitates tethered downgrades, even...