Difference between revisions of "Theos/Setup"
(→For Mac OS X: much of this is not needed, and worse, encourages disabling SIP!)
(→Definitions: there are no set locations, these are just common ones)
|Line 3:||Line 3:|
== Definitions ==
== Definitions ==
<code>$THEOS</code> is the directory where Theos is installed on your machine.
<code>$THEOS</code> is the directory where Theos is installed on your machine. is
* <tt>/var/theos</tt> on iOS
* <tt>/var/theos</tt>on iOS
== Requirements ==
== Requirements ==
Revision as of 06:37, 20 October 2015
This page contains instructions for installing Theos and preparing a new project.
- 1 Definitions
- 2 Requirements
- 3 Setting Up Dependencies
- 4 Installing Theos
- 5 Creating a Project
- 6 Making your Project
- 7 Further Reading
- 8 Getting Help
$THEOS is the directory where Theos is installed on your machine. Theos is self-contained; that is, you simply download it anywhere on your computer and it's ready to go immediately.
Typically, the location of Theos one of these:
- /opt/theos, on OS X or Linux
- /var/theos, on iOS
- ~/theos, if you don't have permission to install Theos to one of the above
- A modern operating system (Mac OS X, iOS [jailbroken], Windows [using Cygwin], and most variants of Linux should work) with the following set of utilities:
- dpkg (port or homebrew install on Mac OS X)
- python (if on Windows)
- Some form of a toolchain or official SDK
- Cydia mobilesubstrate
- Access to a terminal emulator and some knowledge of how to use it
- Objective-C knowledge
More detailed explanations of these requirements are given in the next section, and are dependent on the environment you use.
(If you've never used a command line before, it may be helpful to practice using it so that you have a better understanding of the commands you're about to run. This tutorial may be useful; it's targeted toward Linux, but almost all of the information is the same for the command line on OS X and iOS.)
Setting Up Dependencies
For Mac OS X
Mac OS X comes with most of the necessary tools (subversion, curl, and perl) by default.
You will still need compilation tools and the iOS SDK, and the easiest way to obtain both of these is by installing Xcode from the App Store.
If you don't already have it installed, download Cydia Substrate:
wget http://apt.saurik.com/debs/mobilesubstrate_0.9.6011_iphoneos-arm.deb mkdir substrate dpkg-deb -x mobilesubstrate_*_iphoneos-arm.deb substrate mv substrate/usr/lib/* $THEOS/lib/
Like OS X, most distributions come pre-packaged with the aforementioned tools. On Debian-based distros, APT can be used to install the tools like so:
sudo apt-get install git perl curl
If your distro uses RPM, the process is very similar.
Theos as a package depends on bash, grep, dpkg, coreutils, ldid, rsync and make, so the utilities mentioned in the requirements are automatically installed.
Install a Toolchain:
See On-device toolchains for details.
To do: cygwin, perl, python. Use this.
On Mac OS X or Linux
- Open a terminal window.
- Choose a location for Theos to be installed. If you are unsure, a good choice is /opt/theos.
- If you chose a location outside of your user's home directory, you will probably need to run some or all of the following commands with root permissions.
- Download the latest version of Theos:
- Using git:
git clone git://github.com/DHowett/theos.git $THEOS
- Alternatively, you can use svn, if you prefer:
svn co http://svn.howett.net/svn/theos/trunk $THEOS
- Using git:
- Download ldid to $THEOS/bin:
git clone git://git.saurik.com/ldid.git cd ldid git submodule update --init ./make.sh cp -f ./ldid $THEOS/bin/ldidOr download from one of these sources:
- Add Theos environment variables to your
~/.bash_profile(or the equivalent for your shell). Open
~/.bash_profile(create it if it does not exist) in your favorite editor and add this on the last line, replacing "example" with your device's name (replacing spaces with dashes). If you prefer, you can also use your devices IP address. To find you IP, open settings, select wifi, then press the "i" on the network you are currently connected to. From here you should be able to see your devices IP address:
export THEOS=/opt/theos export PATH=$THEOS/bin:$PATH export THEOS_DEVICE_IP=example.local THEOS_DEVICE_PORT=22Load this into the shell with
. ~/.bash_profile, or close the terminal window and launch a new one.
- As the Substrate library does not come installed on these platforms nor bundled with Theos, copy
/Library/Frameworks/CydiaSubstrate.framework/CydiaSubstratefrom the device to your local
$THEOS/libfolder and rename it to
libsubstrate.dylib. (If you don't do this step, or if you use an old version of Substrate, or if something else goes wrong, you may get one of these error messages). Similarly, copy
/Library/Frameworks/CydiaSubstrate.framework/Headers/CydiaSubstrate.hto your local
$THEOS/includefolder and rename it to
Follow the instructions here.
To do. Use this.
Also for Linux and iOS (and other operating systems other than Mac OS X): Retrieving SDKs
If you aren't using OS X, you must download an iOS SDK. See Retrieving SDKs for details on this.
Take the SDK and put it in
$THEOS/sdks (if it does not exist, create it), with a folder name like iPhoneOS7.0.sdk. As of version 0.9.523, Theos accepts multiple SDKs in that folder.
Each SDK folder should have these folders: Developer, System, usr; and these files: ResourceRules.plist, Entitlements.plist, SDKSettings.plist.
Note that if no SDKs are provided, the following error will be displayed (also noted in the "Troubleshooting" section below):
".../theos/makefiles/targets/darwin-arm/iphone.mk:21: *** first argument to 'word' function must be greater than 0. stop."
Creating a Project
Theos lets you create new projects based on templates using the New Instance Creator (NIC). You do not need to be root to do this step, nor should you be. Start the NIC wizard using the following command:
NIC will prompt you for all the necessary information before creating a project. Please make sure that the path to your current directory doesn't have spaces in it.
(If you get an error message saying "Illegal instruction: 4", see this troubleshooting advice.)
Here is an example of what you will see when using the NIC to create a project (with user input shown in bold):
$ $THEOS/bin/nic.pl NIC 1.0 - New Instance Creator ------------------------------ [1.] iphone/application [2.] iphone/library [3.] iphone/preference_bundle [4.] iphone/tool [5.] iphone/tweak Choose a Template (required): 1 Project Name (required): iPhoneDevWiki Package Name [com.yourcompany.iphonedevwiki]: net.howett.iphonedevwiki Authour/Maintainer Name [Dustin L. Howett]: Instantiating iphone/application in iphonedevwiki/... Done. $
The above will create a folder ./iphonedevwiki in the current working directory - make sure you have permissions to create a folder.
Making your Project
When you have finished developing your tweak/app, you may want to distribute it, either to your own device, or to an external source.
When you are making the project, type this in the terminal, in your project folder:
$ make package
This will generate a .deb file, which you can distribute to people or to repositories.
If you want to install the latest package, type:
$ make install
It will then ask for your root password and install the .deb onto your device. If you haven't changed your root password, the default password is alpine. Make sure you change your root password, which you can do with passwd (see "Root Password How-To" on the Cydia homepage for detailed instructions).
Some wifi spots firewall client devices from each other. That will result in your computer being unable to install onto your iDevice. If this is a problem your computer and your device won't be able to ping each other. It may work for you to set up ad-hoc network. On Mac OS X, under the WiFi menu, this is done with the "Create Network" item. You will need to use static IP addressing.
If you are developing an application, you need to respring your device for your app's icon to show up on SpringBoard. You can always use
killall SpringBoard, but since Saurik added UIKit Tools, it's much nicer to use
You can learn how to do Makefiles with theos on http://uv.howett.net/ipf.html. Start over there.
For general advice on beginning development for jailbroken iOS, see Getting Started.
If you get error messages when compiling your projects, search for your error in Theos/Troubleshooting. It is generalized so it might not be a literal copy of your problem.
If you need further assistance, or if you have other questions about Theos itself, feel free to connect to #theos on irc.saurik.com using your preferred IRC client. If you don't already have a preferred IRC client, you can learn more here: IRC.