Skip to content

Instantly share code, notes, and snippets.

@NSExceptional
Last active February 21, 2018 22:55
Show Gist options
  • Save NSExceptional/ba4853af63ebef35bfd7 to your computer and use it in GitHub Desktop.
Save NSExceptional/ba4853af63ebef35bfd7 to your computer and use it in GitHub Desktop.

#Simple Theos Setup Instructions

Add the following to ~/.bash_profile (create the file if it does not exist by typing touch ~/.bash_profile into terminal. The touch command simply creates a file if it does not exist):

export THEOS=/opt/theos
export PATH=$THEOS/bin:$PATH
export THEOS_DEVICE_IP=your_idevice_ip THEOS_DEVICE_PORT=22

Then quit and reopen Terminal. If any of the following commands fail with regards to $THEOS, you did not do this first step correctly.

$THEOS is a macro for the directory where Theos is installed (usually /opt/theos). So when you see something like cp foo $THEOS/bin/foo, it means "copy foo from the current directory to $THEOS/bin")

Now, assume administrator privileges by typing su and entering your password, or some of the following commands will fail. If you do this then close that Terminal window, you will have to do this again to reassume administrator privileges.

Clone Theos:

git clone git://github.com/theos/theos.git $THEOS

Install ldid:

brew install ldid

... or download it from here and move it to $THEOS/bin (make sure it's still named ldid). Here is a terminal command to move it, where path_to_ldid is wherever the ldid binary is on your system:

mv path_to_ldid $THEOS/bin/ldid

Install wget from Homebrew (if you do not have Homebrew installed, Google "install Homebrew for OS X"):

brew install wget

Then paste the following into Terminal:

wget http://apt.saurik.com/debs/mobilesubstrate_0.9.6011_iphoneos-arm.deb
mkdir substrate
dpkg-deb -x mobilesubstrate_0.9.6011_iphoneos-arm.deb substrate
mv substrate/usr/lib/* $THEOS/lib/
cp substrate/Library/Frameworks/CydiaSubstrate.framework/CydiaSubstrate $THEOS/lib/libsubstrate.dylib
cp substrate/Library/Frameworks/CydiaSubstrate.framework/Headers/CydiaSubstrate.h $THEOS/include/substrate.h
rm -r substrate

This simply downloads substrate and adds a few required files to your Theos installation.

Now you should be able to create a new Theos project by typing nic.pl or $THEOS/bin/nic.pl. If you need additional runtime headers you will have to find them on your own. Throw them in $THEOS/include.


If you're getting a weird dpkg-deb: unknown compression type 'lzma' error, and if you just followed this guide you probably are, see this. Basically you have the new version of dpkg-deb and Cydia uses an old one, and the new one defaults to lzma compression instead of gzip. This can be fixed by editing the file at /opt/theos/makefiles/package/deb.mk to use gzip instead. All I had to do was change the _THEOS_PLATFORM_DPKG_DEB_COMPRESSION variable to gzip.


Link to an install script that may be helpful: https://gist.github.com/tom-go/3342263

@wolfposd
Copy link

rather use this to install ldid:

brew install ldid

@Dershowitz
Copy link

After installing theos, there are 2 problems I encounter:

  1. Whenever I download an open source tweak I get the files like this
    screen shot 2015-12-05 at 10 36 07 am
    But when I create a tweak using NIC on my mac, the same files in my tweak I created are plain.
    screen shot 2015-12-05 at 10 43 30 am
    Is it something I should worry about?

  2. All the open source tweaks I download and compile using theos create a .deb file. But if I create a tweak using NIC and a code from here
    https://jailblog.co/2015/08/13/lets-create-our-first-tweak-popuponstart/
    It says springboard.h file not found and I am just unable to install the springboard headers. One or the other error keeps popping up saying some headers are missing.
    P.S. I am a newbie. Total new to this. If anybody would please help me with proper theos installation and the changes needed to be done once installed, it'd be amazing. Thank you so much.

@NSExceptional
Copy link
Author

@wolfposd: fixed

@Dershowitz:

  1. They should be plain, don't worry about that. They're just text files.
  2. You have to find or make your own headers and either put them in your project folder or in the include folder in your theos installation.

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