Theos/Setup/iOS

From iPhone Development Wiki
Revision as of 03:18, 28 April 2017 by The casle (talk | contribs)

This page is for setting up Theos on an iOS Device. For other platforms see Theos/Setup.

This is the official tutorial, but I simplified to only iOS. Simply run the following command:

git clone --recursive https://github.com/theos/theos.git /var/theos

Now you have Theos on your device, but there are some minor complications that need to be resolved. First, you need to install the 9.3 SDK (I know we are on ios 10 but just use 9.3). Visit [here](http://www.elementscompiler.com/elements/fxs/sdks.aspx) for the SDK, once downloaded and **unzipped**, move it using filza to

 /var/theos/sdks

And it should look like

 /var/theos/sdks/iPhoneOS9.3.sdk

The next step is to create a profile so that theos recognizes where $THEOS is located. Many people have questioned if this is the best solution but it's the only thing that worked for me. If you think I did it wrong I will update if you comment your idea. Anyways, I had no luck using the ~/.bash_profile like you would do on a Mac. I fixed this by instead creating a ~/.profile and putting the export command in there. You can try with bashprofile but it didn't seem to work when I tried :/ Create a new file (edit, more, New file) called .profile in ~ (/var/mobile). Click info on .profile file, scroll down to the spot labeled “sticky” and put the number 0777 so they you can actually run this. Then go into this profile using the text editor built into filza, and write

export THEOS=/var/theos
alias theos=’/var/theos/bin/nic.pl’

Reset terminal now using the switcher so the profile can load up. Now you can create a Development folder, I put mine in /User/Documents/Development so that you can work on your tweaks. cd into your new folder using MTerminal, this should **not** be done in root.

 cd /User/Documents/Development

Once there run your newly created alias called

theos

You should hopefully get a popup of the templates. Type the number that correlates to the tweak template, enter “blank” for name of tweak, and then click enter a bunch of times as this is just a test tweak and doesn't require the rest of the information. Now, still in terminal cd into the new project using

 cd blank/

You should be able to run

make package install

This is going to compile nothing really, but if it works and you successfully install a blank tweak then congratulations, theos works! Otherwise go to [here](http://iphonedevwiki.net/index.php/Theos/Troubleshooting) and match the error with the examples and I'll try to help in the comments. You may need to update Theos every once in awhile (like every few months),

make update-theos


Requirements

  • A jailbroken iOS device with Cydia (or another package manager) installed.
  • Knowledge on how to use a command line terminal.
  • Objective C knowledge.

Optional Requirements

  • OpenSSH installed on your device and a computer that you can SSH into your device with (using MobileTerminal gets tedious pretty quickly).

Installing Theos and it's dependencies

  1. Add the following repositories to your Cydia sources.
  2. Install the following packages in Cydia:
    • Perl
    • Theos
    • iOS Toolchain
  3. Check that Theos is installed on your device by running:
    echo $THEOS

    The output should be: /var/theos

Setting up the iOS SDK

Navigate to https://sdks.website and check which iOS SDK you wish to download.

  1. Create a directory for the SDK to be placed in:
    mkdir -p $THEOS/sdks
  2. Download the SDK temporarily and extract to the SDK directory:
    curl -ksL "https://sdks.website/dl/iPhoneOSX.Y.sdk.tbz2" | tar -xj -C $THEOS/sdks

    X.Y being the version numbers of the SDK, as seen in https://sdks.website/.

Additional Step for 64 bit (ARM64) Devices

With the current version of Theos (0.9.639-1), building on ARM64 will throw an error. The following will solve this issue.

  1. Create symlinks to support ARM64:
    ln -s $THEOS/makefiles/platform/Darwin-arm.mk $THEOS/makefiles/platform/Darwin-arm64.mk
    ln -s $THEOS/makefiles/targets/Darwin-arm $THEOS/makefiles/targets/Darwin-arm64

Complete Text Tutorial by iOSChris

If you are having any issues following the tutorial above and need more clarification on the setup process, visit my tutorial located at the following address: