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

Essential Tips to Secure Your iOS Devices

Essential Tips to Secure Your iOS Devices

It’s never been more important to secure your iOS devices. iPhones and iPads are rapidly becoming every part of our daily lives, and with it the growing amount of sensitive information stored on these devices. Our devices full of data, ranging from...

RDAR Dynamic Island fix for iOS

How to Fix Dynamic Island RDAR Error 45025538 Issue on iPhone

When you enable Dynamic Island on unsupported devices, you might notice a "rdar" error, which appears as a red bar at the top of the screen. This happens because of a resolution change when activating Dynamic Island on iOS 17.0 to 18.0. The issue mainly...

Create High-Quality AI Videos with Vidnoz AI

How to Create High-Quality AI Videos for Free with Vidnoz AI

Video content has become a vital tool in today's digital age for successfully catching attention, engaging audiences, and communicating ideas. But producing videos of a high caliber frequently takes a large investment of time, resources, & skill. Especially...