ONE Jailbreak Ad

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.
Author Photo
Written by

Kuba has over 20 years of experience in journalism, focusing on jailbreak since 2012. He has interviewed professionals from various companies. Besides journalism, Kuba specializes in video editing and drone flying. He studied IT at university before his writing career.

Post a comment

Latest Posts

iOS 18.4.1 is Coming Soon

iOS 18.4.1: Everything You Need to Know About the Update

Apple’s iOS 18.4.1 is a focused maintenance update designed to refine the iPhone experience by addressing critical bugs and security vulnerabilities. Slated for release in late April 2025. Jailbreaking this version will not...

Alternatives to iOS 18 Jailbreak

Jailbreak iOS 18/18.4: Best Alternatives to Customize iPhone

No, you can’t jailbreak iOS 18. Apple has fixed all the known exploits, so there’s no way to crack the latest iOS firmware—at least not with any publicly available methods. Be wary of websites claiming to offer ...

Nugget

Nugget unlocks your iPhones full potential on iOS 18

LeminLimez released a new project that allows users to activate some hidden iOS features on iOS 17.0. I took a look into Nugget, an open-source software that promises to enable Dynamic Island, Always On Display, set device model name, disable region restrictions...