https://iphonedev.wiki/api.php?action=feedcontributions&user=The+casle&feedformat=atomiPhone Development Wiki - User contributions [en]2024-03-28T12:30:04ZUser contributionsMediaWiki 1.39.6https://iphonedev.wiki/index.php?title=Theos/Setup&diff=4999Theos/Setup2017-06-01T03:14:07Z<p>The casle: </p>
<hr />
<div>{{''Warning | This article is BEING UPDATED, please read [https://github.com/theos/theos/wiki/Installation these instructions instead].''' }}<br />
<br />
This page contains instructions for installing [[Theos]] and preparing a new project.<br />
<br />
== Definitions ==<br />
==='''OUTDATED GO TO LINK ABOVE PLEASE GUYS'''===<br />
<code>$THEOS</code> 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.<br />
<br />
Typically, the location of Theos one of these:<br />
<br />
* <tt>/opt/theos</tt>, on OS X or Linux<br />
* <tt>/var/theos</tt>, on iOS<br />
* <tt>~/theos</tt>, if you don't have permission to install Theos to one of the above<br />
<br />
== Requirements ==<br />
<br />
* 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:<br />
** curl<br />
** git<br />
** make<br />
** openssh<br />
** perl<br />
** rsync<br />
** dpkg (port or homebrew install on Mac OS X)<br />
** python (if on Windows)<br />
* Some form of a toolchain or official SDK<br />
* Cydia [http://apt.saurik.com/debs/ mobilesubstrate]<br />
* Access to a terminal emulator and some knowledge of how to use it<br />
* '''Objective-C knowledge'''<br />
<br />
More detailed explanations of these requirements are given in the next section, and are dependent on the environment you use.<br />
<br />
(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. [http://ryanstutorials.net/linuxtutorial/ 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.)<br />
<br />
== Setting Up Dependencies ==<br />
<br />
=== For Mac OS X ===<br />
<br />
Mac OS X comes with most of the necessary tools (subversion, curl, and perl) by default.<br />
<br />
You will still need compilation tools and the iOS SDK, and the easiest way to obtain both of these is by installing Xcode from [https://itunes.apple.com/app/xcode/id497799835?mt=12 the App Store].<br />
<br />
Install dpkg via your installed package manager, which might be either <code>[http://brew.sh/ brew] install dpkg</code> or <code>[https://www.macports.org/ port] install dpkg</code>.<br />
<br />
Your package manager may also have [[ldid]]. Fink and Homebrew do. If not, compile and install it yourself:<br />
<br />
<pre>git clone git://git.saurik.com/ldid.git<br />
cd ldid<br />
git submodule update --init<br />
./make.sh<br />
cp -f ./ldid $THEOS/bin/ldid</pre><br />
<br />
Or download from one of these sources:<br />
<br />
* http://joedj.net/ldid<br />
* http://jontelang.com/guide/chapter2/ldid.html<br />
<br />
=== For Linux ===<br />
<br />
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:<br />
<pre>sudo apt-get install git perl curl</pre><br />
<br />
If your distro uses RPM, the process is very similar.<br />
<br />
Ensure you have dpkg and ldid (see above).<br />
<br />
=== For iOS ===<br />
<br />
'''Dependencies:'''<br />
<br />
Theos as a package depends on bash, grep, dpkg, coreutils, ldid, rsync and make, so the utilities mentioned in the requirements are automatically installed.<br />
<br />
'''Install a Toolchain:''' <br />
<br />
See [[On-device toolchains]] for details.<br />
<br />
=== For Windows ===<br />
<br />
''To do: cygwin, perl, python. Use [http://coolstar.org/theos.pdf this].''<br />
<br />
== Installing Theos ==<br />
<br />
=== On Mac OS X or Linux ===<br />
<br />
# Open a terminal window.<br />
# Choose a location for Theos to be installed. If you are unsure, a good choice is <tt>/opt/theos</tt>.<pre>export THEOS=/opt/theos</pre><br />
#* 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.<br />
# Download the latest version of Theos:<br />
#* Using git: <pre>git clone --recursive git://github.com/theos/theos.git $THEOS</pre><br />
# Add Theos environment variables to your <code>~/.bash_profile</code> (or the equivalent for your shell). Open <code>~/.bash_profile</code> (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: <!-- this bit of text is borrowed from http://sharedinstance.net/2013/12/build-on-windows/ with permission, thanks kirb! --><br><pre>export THEOS=/opt/theos&#10;export PATH=$THEOS/bin:$PATH&#10;export THEOS_DEVICE_IP=example.local THEOS_DEVICE_PORT=22</pre>Load this into the shell with <code>. ~/.bash_profile</code>, or close the terminal window and launch a new one.<br />
# As the Substrate library does not come installed on these platforms nor bundled with Theos, copy <code>/Library/Frameworks/CydiaSubstrate.framework/CydiaSubstrate</code> from the device to your local <code>$THEOS/lib</code> folder and rename it to <code>libsubstrate.dylib</code>. (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 [[Theos/Troubleshooting#Missing_Substrate_library|one of these error messages]]). Similarly, copy <code>/Library/Frameworks/CydiaSubstrate.framework/Headers/CydiaSubstrate.h</code> to your local <code>$THEOS/include</code> folder and rename it to <code>substrate.h</code>. You can alternatively retrieve files directly from the package: <pre>wget http://apt.saurik.com/debs/mobilesubstrate_0.9.6011_iphoneos-arm.deb&#10;mkdir substrate&#10;dpkg-deb -x mobilesubstrate_*_iphoneos-arm.deb substrate&#10;mv substrate/Library/Frameworks/CydiaSubstrate.framework/CydiaSubstrate $THEOS/lib/libsubstrate.dylib&#10;mv substrate/Library/Frameworks/CydiaSubstrate.framework/Headers/CydiaSubstrate.h $THEOS/include/substrate.h</pre><br />
<br />
=== On iOS ===<br />
<br />
Follow the instructions [[Theos/Setup/iOS | here]].<br />
<br />
=== On Windows ===<br />
<br />
''To do. Use [http://coolstar.org/theos.pdf this].''<br />
<br />
=== Also for Linux and iOS (and other operating systems other than Mac OS X): Retrieving SDKs ===<br />
<br />
If you aren't using OS X, you must download an iOS SDK. See [[Retrieving SDKs]] for details on this.<br />
<br />
Take the SDK and put it in <code>$THEOS/sdks</code> (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.<br />
<br />
Each SDK folder should have these folders: Developer, System, usr; and these files: ResourceRules.plist, Entitlements.plist, SDKSettings.plist.<br />
<br />
Note that if no SDKs are provided, the following error will be displayed (also noted in the [[Theos/Troubleshooting|Troubleshooting page]]): <pre>".../theos/makefiles/targets/darwin-arm/iphone.mk:21: *** first argument to 'word' function must be greater than 0. stop."</pre><br />
<br />
== Creating a Project ==<br />
<br />
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:<br />
<br />
$THEOS/bin/nic.pl<br />
<br />
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.<br />
<br />
(If you get an error message saying "Illegal instruction: 4", [[Theos/Troubleshooting#Architecture_.28partial.29_incompatibility|see this troubleshooting advice]].)<br />
<br />
=== NIC Example ===<br />
<br />
Here is an example of what you will see when using the NIC to create a project (with user input shown in bold):<br />
<br />
$ '''$THEOS/bin/nic.pl'''<br />
NIC 1.0 - New Instance Creator<br />
------------------------------<br />
[1.] iphone/application<br />
[2.] iphone/library<br />
[3.] iphone/preference_bundle<br />
[4.] iphone/tool<br />
[5.] iphone/tweak<br />
Choose a Template (required): '''1'''<br />
Project Name (required): '''iPhoneDevWiki'''<br />
Package Name [com.yourcompany.iphonedevwiki]: '''net.howett.iphonedevwiki'''<br />
Authour/Maintainer Name [Dustin L. Howett]: <br />
Instantiating iphone/application in iphonedevwiki/...<br />
Done.<br />
$<br />
<br />
The above will create a folder <tt>./iphonedevwiki</tt> in the current working directory - make sure you have permissions to create a folder.<br />
<br />
== Making your Project ==<br />
<br />
When you have finished developing your tweak/app, you may want to distribute it, either to your own device, or to an external source.<br />
<br />
When you are making the project, type this in the terminal, in your project folder:<br />
<br />
$ make package <br />
<br />
This will generate a .deb file, which you can distribute to people or to repositories.<br />
<br />
If you want to install the latest package, type:<br />
<br />
$ make install<br />
<br />
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).<br />
<br />
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.<br />
<br />
If you are developing an application, you need to force the icon cache to be reloaded for your app's icon to show up. Restarting SpringBoard is not effective, since this does not rebuild the cache. Simply run:<br />
<br />
$ uicache<br />
<br />
== Further Reading ==<br />
<br />
You can learn how to do Makefiles with theos on http://uv.howett.net/ipf.html. Start over there.<br />
<br />
For general advice on beginning development for jailbroken iOS, see [[Getting Started]].<br />
<br />
== Getting Help ==<br />
<br />
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.<br />
<br />
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]].</div>The caslehttps://iphonedev.wiki/index.php?title=Theos/Setup&diff=4998Theos/Setup2017-06-01T03:13:47Z<p>The casle: </p>
<hr />
<div>{{''{Warning | This article is BEING UPDATED, please read [https://github.com/theos/theos/wiki/Installation these instructions instead].''' }}<br />
<br />
This page contains instructions for installing [[Theos]] and preparing a new project.<br />
<br />
== Definitions ==<br />
==='''OUTDATED GO TO LINK ABOVE PLEASE GUYS'''===<br />
<code>$THEOS</code> 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.<br />
<br />
Typically, the location of Theos one of these:<br />
<br />
* <tt>/opt/theos</tt>, on OS X or Linux<br />
* <tt>/var/theos</tt>, on iOS<br />
* <tt>~/theos</tt>, if you don't have permission to install Theos to one of the above<br />
<br />
== Requirements ==<br />
<br />
* 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:<br />
** curl<br />
** git<br />
** make<br />
** openssh<br />
** perl<br />
** rsync<br />
** dpkg (port or homebrew install on Mac OS X)<br />
** python (if on Windows)<br />
* Some form of a toolchain or official SDK<br />
* Cydia [http://apt.saurik.com/debs/ mobilesubstrate]<br />
* Access to a terminal emulator and some knowledge of how to use it<br />
* '''Objective-C knowledge'''<br />
<br />
More detailed explanations of these requirements are given in the next section, and are dependent on the environment you use.<br />
<br />
(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. [http://ryanstutorials.net/linuxtutorial/ 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.)<br />
<br />
== Setting Up Dependencies ==<br />
<br />
=== For Mac OS X ===<br />
<br />
Mac OS X comes with most of the necessary tools (subversion, curl, and perl) by default.<br />
<br />
You will still need compilation tools and the iOS SDK, and the easiest way to obtain both of these is by installing Xcode from [https://itunes.apple.com/app/xcode/id497799835?mt=12 the App Store].<br />
<br />
Install dpkg via your installed package manager, which might be either <code>[http://brew.sh/ brew] install dpkg</code> or <code>[https://www.macports.org/ port] install dpkg</code>.<br />
<br />
Your package manager may also have [[ldid]]. Fink and Homebrew do. If not, compile and install it yourself:<br />
<br />
<pre>git clone git://git.saurik.com/ldid.git<br />
cd ldid<br />
git submodule update --init<br />
./make.sh<br />
cp -f ./ldid $THEOS/bin/ldid</pre><br />
<br />
Or download from one of these sources:<br />
<br />
* http://joedj.net/ldid<br />
* http://jontelang.com/guide/chapter2/ldid.html<br />
<br />
=== For Linux ===<br />
<br />
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:<br />
<pre>sudo apt-get install git perl curl</pre><br />
<br />
If your distro uses RPM, the process is very similar.<br />
<br />
Ensure you have dpkg and ldid (see above).<br />
<br />
=== For iOS ===<br />
<br />
'''Dependencies:'''<br />
<br />
Theos as a package depends on bash, grep, dpkg, coreutils, ldid, rsync and make, so the utilities mentioned in the requirements are automatically installed.<br />
<br />
'''Install a Toolchain:''' <br />
<br />
See [[On-device toolchains]] for details.<br />
<br />
=== For Windows ===<br />
<br />
''To do: cygwin, perl, python. Use [http://coolstar.org/theos.pdf this].''<br />
<br />
== Installing Theos ==<br />
<br />
=== On Mac OS X or Linux ===<br />
<br />
# Open a terminal window.<br />
# Choose a location for Theos to be installed. If you are unsure, a good choice is <tt>/opt/theos</tt>.<pre>export THEOS=/opt/theos</pre><br />
#* 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.<br />
# Download the latest version of Theos:<br />
#* Using git: <pre>git clone --recursive git://github.com/theos/theos.git $THEOS</pre><br />
# Add Theos environment variables to your <code>~/.bash_profile</code> (or the equivalent for your shell). Open <code>~/.bash_profile</code> (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: <!-- this bit of text is borrowed from http://sharedinstance.net/2013/12/build-on-windows/ with permission, thanks kirb! --><br><pre>export THEOS=/opt/theos&#10;export PATH=$THEOS/bin:$PATH&#10;export THEOS_DEVICE_IP=example.local THEOS_DEVICE_PORT=22</pre>Load this into the shell with <code>. ~/.bash_profile</code>, or close the terminal window and launch a new one.<br />
# As the Substrate library does not come installed on these platforms nor bundled with Theos, copy <code>/Library/Frameworks/CydiaSubstrate.framework/CydiaSubstrate</code> from the device to your local <code>$THEOS/lib</code> folder and rename it to <code>libsubstrate.dylib</code>. (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 [[Theos/Troubleshooting#Missing_Substrate_library|one of these error messages]]). Similarly, copy <code>/Library/Frameworks/CydiaSubstrate.framework/Headers/CydiaSubstrate.h</code> to your local <code>$THEOS/include</code> folder and rename it to <code>substrate.h</code>. You can alternatively retrieve files directly from the package: <pre>wget http://apt.saurik.com/debs/mobilesubstrate_0.9.6011_iphoneos-arm.deb&#10;mkdir substrate&#10;dpkg-deb -x mobilesubstrate_*_iphoneos-arm.deb substrate&#10;mv substrate/Library/Frameworks/CydiaSubstrate.framework/CydiaSubstrate $THEOS/lib/libsubstrate.dylib&#10;mv substrate/Library/Frameworks/CydiaSubstrate.framework/Headers/CydiaSubstrate.h $THEOS/include/substrate.h</pre><br />
<br />
=== On iOS ===<br />
<br />
Follow the instructions [[Theos/Setup/iOS | here]].<br />
<br />
=== On Windows ===<br />
<br />
''To do. Use [http://coolstar.org/theos.pdf this].''<br />
<br />
=== Also for Linux and iOS (and other operating systems other than Mac OS X): Retrieving SDKs ===<br />
<br />
If you aren't using OS X, you must download an iOS SDK. See [[Retrieving SDKs]] for details on this.<br />
<br />
Take the SDK and put it in <code>$THEOS/sdks</code> (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.<br />
<br />
Each SDK folder should have these folders: Developer, System, usr; and these files: ResourceRules.plist, Entitlements.plist, SDKSettings.plist.<br />
<br />
Note that if no SDKs are provided, the following error will be displayed (also noted in the [[Theos/Troubleshooting|Troubleshooting page]]): <pre>".../theos/makefiles/targets/darwin-arm/iphone.mk:21: *** first argument to 'word' function must be greater than 0. stop."</pre><br />
<br />
== Creating a Project ==<br />
<br />
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:<br />
<br />
$THEOS/bin/nic.pl<br />
<br />
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.<br />
<br />
(If you get an error message saying "Illegal instruction: 4", [[Theos/Troubleshooting#Architecture_.28partial.29_incompatibility|see this troubleshooting advice]].)<br />
<br />
=== NIC Example ===<br />
<br />
Here is an example of what you will see when using the NIC to create a project (with user input shown in bold):<br />
<br />
$ '''$THEOS/bin/nic.pl'''<br />
NIC 1.0 - New Instance Creator<br />
------------------------------<br />
[1.] iphone/application<br />
[2.] iphone/library<br />
[3.] iphone/preference_bundle<br />
[4.] iphone/tool<br />
[5.] iphone/tweak<br />
Choose a Template (required): '''1'''<br />
Project Name (required): '''iPhoneDevWiki'''<br />
Package Name [com.yourcompany.iphonedevwiki]: '''net.howett.iphonedevwiki'''<br />
Authour/Maintainer Name [Dustin L. Howett]: <br />
Instantiating iphone/application in iphonedevwiki/...<br />
Done.<br />
$<br />
<br />
The above will create a folder <tt>./iphonedevwiki</tt> in the current working directory - make sure you have permissions to create a folder.<br />
<br />
== Making your Project ==<br />
<br />
When you have finished developing your tweak/app, you may want to distribute it, either to your own device, or to an external source.<br />
<br />
When you are making the project, type this in the terminal, in your project folder:<br />
<br />
$ make package <br />
<br />
This will generate a .deb file, which you can distribute to people or to repositories.<br />
<br />
If you want to install the latest package, type:<br />
<br />
$ make install<br />
<br />
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).<br />
<br />
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.<br />
<br />
If you are developing an application, you need to force the icon cache to be reloaded for your app's icon to show up. Restarting SpringBoard is not effective, since this does not rebuild the cache. Simply run:<br />
<br />
$ uicache<br />
<br />
== Further Reading ==<br />
<br />
You can learn how to do Makefiles with theos on http://uv.howett.net/ipf.html. Start over there.<br />
<br />
For general advice on beginning development for jailbroken iOS, see [[Getting Started]].<br />
<br />
== Getting Help ==<br />
<br />
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.<br />
<br />
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]].</div>The caslehttps://iphonedev.wiki/index.php?title=Theos/Setup&diff=4997Theos/Setup2017-06-01T03:12:33Z<p>The casle: </p>
<hr />
<div>{{==='''OUTDATED'''=== | This article is BEING UPDATED, please read [https://github.com/theos/theos/wiki/Installation these instructions instead]. }}<br />
<br />
This page contains instructions for installing [[Theos]] and preparing a new project.<br />
<br />
== Definitions ==<br />
==='''OUTDATED GO TO LINK ABOVE PLEASE GUYS'''===<br />
<code>$THEOS</code> 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.<br />
<br />
Typically, the location of Theos one of these:<br />
<br />
* <tt>/opt/theos</tt>, on OS X or Linux<br />
* <tt>/var/theos</tt>, on iOS<br />
* <tt>~/theos</tt>, if you don't have permission to install Theos to one of the above<br />
<br />
== Requirements ==<br />
<br />
* 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:<br />
** curl<br />
** git<br />
** make<br />
** openssh<br />
** perl<br />
** rsync<br />
** dpkg (port or homebrew install on Mac OS X)<br />
** python (if on Windows)<br />
* Some form of a toolchain or official SDK<br />
* Cydia [http://apt.saurik.com/debs/ mobilesubstrate]<br />
* Access to a terminal emulator and some knowledge of how to use it<br />
* '''Objective-C knowledge'''<br />
<br />
More detailed explanations of these requirements are given in the next section, and are dependent on the environment you use.<br />
<br />
(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. [http://ryanstutorials.net/linuxtutorial/ 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.)<br />
<br />
== Setting Up Dependencies ==<br />
<br />
=== For Mac OS X ===<br />
<br />
Mac OS X comes with most of the necessary tools (subversion, curl, and perl) by default.<br />
<br />
You will still need compilation tools and the iOS SDK, and the easiest way to obtain both of these is by installing Xcode from [https://itunes.apple.com/app/xcode/id497799835?mt=12 the App Store].<br />
<br />
Install dpkg via your installed package manager, which might be either <code>[http://brew.sh/ brew] install dpkg</code> or <code>[https://www.macports.org/ port] install dpkg</code>.<br />
<br />
Your package manager may also have [[ldid]]. Fink and Homebrew do. If not, compile and install it yourself:<br />
<br />
<pre>git clone git://git.saurik.com/ldid.git<br />
cd ldid<br />
git submodule update --init<br />
./make.sh<br />
cp -f ./ldid $THEOS/bin/ldid</pre><br />
<br />
Or download from one of these sources:<br />
<br />
* http://joedj.net/ldid<br />
* http://jontelang.com/guide/chapter2/ldid.html<br />
<br />
=== For Linux ===<br />
<br />
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:<br />
<pre>sudo apt-get install git perl curl</pre><br />
<br />
If your distro uses RPM, the process is very similar.<br />
<br />
Ensure you have dpkg and ldid (see above).<br />
<br />
=== For iOS ===<br />
<br />
'''Dependencies:'''<br />
<br />
Theos as a package depends on bash, grep, dpkg, coreutils, ldid, rsync and make, so the utilities mentioned in the requirements are automatically installed.<br />
<br />
'''Install a Toolchain:''' <br />
<br />
See [[On-device toolchains]] for details.<br />
<br />
=== For Windows ===<br />
<br />
''To do: cygwin, perl, python. Use [http://coolstar.org/theos.pdf this].''<br />
<br />
== Installing Theos ==<br />
<br />
=== On Mac OS X or Linux ===<br />
<br />
# Open a terminal window.<br />
# Choose a location for Theos to be installed. If you are unsure, a good choice is <tt>/opt/theos</tt>.<pre>export THEOS=/opt/theos</pre><br />
#* 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.<br />
# Download the latest version of Theos:<br />
#* Using git: <pre>git clone --recursive git://github.com/theos/theos.git $THEOS</pre><br />
# Add Theos environment variables to your <code>~/.bash_profile</code> (or the equivalent for your shell). Open <code>~/.bash_profile</code> (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: <!-- this bit of text is borrowed from http://sharedinstance.net/2013/12/build-on-windows/ with permission, thanks kirb! --><br><pre>export THEOS=/opt/theos&#10;export PATH=$THEOS/bin:$PATH&#10;export THEOS_DEVICE_IP=example.local THEOS_DEVICE_PORT=22</pre>Load this into the shell with <code>. ~/.bash_profile</code>, or close the terminal window and launch a new one.<br />
# As the Substrate library does not come installed on these platforms nor bundled with Theos, copy <code>/Library/Frameworks/CydiaSubstrate.framework/CydiaSubstrate</code> from the device to your local <code>$THEOS/lib</code> folder and rename it to <code>libsubstrate.dylib</code>. (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 [[Theos/Troubleshooting#Missing_Substrate_library|one of these error messages]]). Similarly, copy <code>/Library/Frameworks/CydiaSubstrate.framework/Headers/CydiaSubstrate.h</code> to your local <code>$THEOS/include</code> folder and rename it to <code>substrate.h</code>. You can alternatively retrieve files directly from the package: <pre>wget http://apt.saurik.com/debs/mobilesubstrate_0.9.6011_iphoneos-arm.deb&#10;mkdir substrate&#10;dpkg-deb -x mobilesubstrate_*_iphoneos-arm.deb substrate&#10;mv substrate/Library/Frameworks/CydiaSubstrate.framework/CydiaSubstrate $THEOS/lib/libsubstrate.dylib&#10;mv substrate/Library/Frameworks/CydiaSubstrate.framework/Headers/CydiaSubstrate.h $THEOS/include/substrate.h</pre><br />
<br />
=== On iOS ===<br />
<br />
Follow the instructions [[Theos/Setup/iOS | here]].<br />
<br />
=== On Windows ===<br />
<br />
''To do. Use [http://coolstar.org/theos.pdf this].''<br />
<br />
=== Also for Linux and iOS (and other operating systems other than Mac OS X): Retrieving SDKs ===<br />
<br />
If you aren't using OS X, you must download an iOS SDK. See [[Retrieving SDKs]] for details on this.<br />
<br />
Take the SDK and put it in <code>$THEOS/sdks</code> (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.<br />
<br />
Each SDK folder should have these folders: Developer, System, usr; and these files: ResourceRules.plist, Entitlements.plist, SDKSettings.plist.<br />
<br />
Note that if no SDKs are provided, the following error will be displayed (also noted in the [[Theos/Troubleshooting|Troubleshooting page]]): <pre>".../theos/makefiles/targets/darwin-arm/iphone.mk:21: *** first argument to 'word' function must be greater than 0. stop."</pre><br />
<br />
== Creating a Project ==<br />
<br />
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:<br />
<br />
$THEOS/bin/nic.pl<br />
<br />
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.<br />
<br />
(If you get an error message saying "Illegal instruction: 4", [[Theos/Troubleshooting#Architecture_.28partial.29_incompatibility|see this troubleshooting advice]].)<br />
<br />
=== NIC Example ===<br />
<br />
Here is an example of what you will see when using the NIC to create a project (with user input shown in bold):<br />
<br />
$ '''$THEOS/bin/nic.pl'''<br />
NIC 1.0 - New Instance Creator<br />
------------------------------<br />
[1.] iphone/application<br />
[2.] iphone/library<br />
[3.] iphone/preference_bundle<br />
[4.] iphone/tool<br />
[5.] iphone/tweak<br />
Choose a Template (required): '''1'''<br />
Project Name (required): '''iPhoneDevWiki'''<br />
Package Name [com.yourcompany.iphonedevwiki]: '''net.howett.iphonedevwiki'''<br />
Authour/Maintainer Name [Dustin L. Howett]: <br />
Instantiating iphone/application in iphonedevwiki/...<br />
Done.<br />
$<br />
<br />
The above will create a folder <tt>./iphonedevwiki</tt> in the current working directory - make sure you have permissions to create a folder.<br />
<br />
== Making your Project ==<br />
<br />
When you have finished developing your tweak/app, you may want to distribute it, either to your own device, or to an external source.<br />
<br />
When you are making the project, type this in the terminal, in your project folder:<br />
<br />
$ make package <br />
<br />
This will generate a .deb file, which you can distribute to people or to repositories.<br />
<br />
If you want to install the latest package, type:<br />
<br />
$ make install<br />
<br />
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).<br />
<br />
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.<br />
<br />
If you are developing an application, you need to force the icon cache to be reloaded for your app's icon to show up. Restarting SpringBoard is not effective, since this does not rebuild the cache. Simply run:<br />
<br />
$ uicache<br />
<br />
== Further Reading ==<br />
<br />
You can learn how to do Makefiles with theos on http://uv.howett.net/ipf.html. Start over there.<br />
<br />
For general advice on beginning development for jailbroken iOS, see [[Getting Started]].<br />
<br />
== Getting Help ==<br />
<br />
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.<br />
<br />
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]].</div>The caslehttps://iphonedev.wiki/index.php?title=Theos/Setup&diff=4996Theos/Setup2017-06-01T03:06:48Z<p>The casle: /* OUTDATED GO TO LINK ABOVE PLEASE GUYS */</p>
<hr />
<div>{{Warning | This article is BEING UPDATED, please read [https://github.com/theos/theos/wiki/Installation these instructions instead]. }}<br />
<br />
This page contains instructions for installing [[Theos]] and preparing a new project.<br />
<br />
== Definitions ==<br />
==='''OUTDATED GO TO LINK ABOVE PLEASE GUYS'''===<br />
<code>$THEOS</code> 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.<br />
<br />
Typically, the location of Theos one of these:<br />
<br />
* <tt>/opt/theos</tt>, on OS X or Linux<br />
* <tt>/var/theos</tt>, on iOS<br />
* <tt>~/theos</tt>, if you don't have permission to install Theos to one of the above<br />
<br />
== Requirements ==<br />
<br />
* 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:<br />
** curl<br />
** git<br />
** make<br />
** openssh<br />
** perl<br />
** rsync<br />
** dpkg (port or homebrew install on Mac OS X)<br />
** python (if on Windows)<br />
* Some form of a toolchain or official SDK<br />
* Cydia [http://apt.saurik.com/debs/ mobilesubstrate]<br />
* Access to a terminal emulator and some knowledge of how to use it<br />
* '''Objective-C knowledge'''<br />
<br />
More detailed explanations of these requirements are given in the next section, and are dependent on the environment you use.<br />
<br />
(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. [http://ryanstutorials.net/linuxtutorial/ 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.)<br />
<br />
== Setting Up Dependencies ==<br />
<br />
=== For Mac OS X ===<br />
<br />
Mac OS X comes with most of the necessary tools (subversion, curl, and perl) by default.<br />
<br />
You will still need compilation tools and the iOS SDK, and the easiest way to obtain both of these is by installing Xcode from [https://itunes.apple.com/app/xcode/id497799835?mt=12 the App Store].<br />
<br />
Install dpkg via your installed package manager, which might be either <code>[http://brew.sh/ brew] install dpkg</code> or <code>[https://www.macports.org/ port] install dpkg</code>.<br />
<br />
Your package manager may also have [[ldid]]. Fink and Homebrew do. If not, compile and install it yourself:<br />
<br />
<pre>git clone git://git.saurik.com/ldid.git<br />
cd ldid<br />
git submodule update --init<br />
./make.sh<br />
cp -f ./ldid $THEOS/bin/ldid</pre><br />
<br />
Or download from one of these sources:<br />
<br />
* http://joedj.net/ldid<br />
* http://jontelang.com/guide/chapter2/ldid.html<br />
<br />
=== For Linux ===<br />
<br />
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:<br />
<pre>sudo apt-get install git perl curl</pre><br />
<br />
If your distro uses RPM, the process is very similar.<br />
<br />
Ensure you have dpkg and ldid (see above).<br />
<br />
=== For iOS ===<br />
<br />
'''Dependencies:'''<br />
<br />
Theos as a package depends on bash, grep, dpkg, coreutils, ldid, rsync and make, so the utilities mentioned in the requirements are automatically installed.<br />
<br />
'''Install a Toolchain:''' <br />
<br />
See [[On-device toolchains]] for details.<br />
<br />
=== For Windows ===<br />
<br />
''To do: cygwin, perl, python. Use [http://coolstar.org/theos.pdf this].''<br />
<br />
== Installing Theos ==<br />
<br />
=== On Mac OS X or Linux ===<br />
<br />
# Open a terminal window.<br />
# Choose a location for Theos to be installed. If you are unsure, a good choice is <tt>/opt/theos</tt>.<pre>export THEOS=/opt/theos</pre><br />
#* 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.<br />
# Download the latest version of Theos:<br />
#* Using git: <pre>git clone --recursive git://github.com/theos/theos.git $THEOS</pre><br />
# Add Theos environment variables to your <code>~/.bash_profile</code> (or the equivalent for your shell). Open <code>~/.bash_profile</code> (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: <!-- this bit of text is borrowed from http://sharedinstance.net/2013/12/build-on-windows/ with permission, thanks kirb! --><br><pre>export THEOS=/opt/theos&#10;export PATH=$THEOS/bin:$PATH&#10;export THEOS_DEVICE_IP=example.local THEOS_DEVICE_PORT=22</pre>Load this into the shell with <code>. ~/.bash_profile</code>, or close the terminal window and launch a new one.<br />
# As the Substrate library does not come installed on these platforms nor bundled with Theos, copy <code>/Library/Frameworks/CydiaSubstrate.framework/CydiaSubstrate</code> from the device to your local <code>$THEOS/lib</code> folder and rename it to <code>libsubstrate.dylib</code>. (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 [[Theos/Troubleshooting#Missing_Substrate_library|one of these error messages]]). Similarly, copy <code>/Library/Frameworks/CydiaSubstrate.framework/Headers/CydiaSubstrate.h</code> to your local <code>$THEOS/include</code> folder and rename it to <code>substrate.h</code>. You can alternatively retrieve files directly from the package: <pre>wget http://apt.saurik.com/debs/mobilesubstrate_0.9.6011_iphoneos-arm.deb&#10;mkdir substrate&#10;dpkg-deb -x mobilesubstrate_*_iphoneos-arm.deb substrate&#10;mv substrate/Library/Frameworks/CydiaSubstrate.framework/CydiaSubstrate $THEOS/lib/libsubstrate.dylib&#10;mv substrate/Library/Frameworks/CydiaSubstrate.framework/Headers/CydiaSubstrate.h $THEOS/include/substrate.h</pre><br />
<br />
=== On iOS ===<br />
<br />
Follow the instructions [[Theos/Setup/iOS | here]].<br />
<br />
=== On Windows ===<br />
<br />
''To do. Use [http://coolstar.org/theos.pdf this].''<br />
<br />
=== Also for Linux and iOS (and other operating systems other than Mac OS X): Retrieving SDKs ===<br />
<br />
If you aren't using OS X, you must download an iOS SDK. See [[Retrieving SDKs]] for details on this.<br />
<br />
Take the SDK and put it in <code>$THEOS/sdks</code> (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.<br />
<br />
Each SDK folder should have these folders: Developer, System, usr; and these files: ResourceRules.plist, Entitlements.plist, SDKSettings.plist.<br />
<br />
Note that if no SDKs are provided, the following error will be displayed (also noted in the [[Theos/Troubleshooting|Troubleshooting page]]): <pre>".../theos/makefiles/targets/darwin-arm/iphone.mk:21: *** first argument to 'word' function must be greater than 0. stop."</pre><br />
<br />
== Creating a Project ==<br />
<br />
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:<br />
<br />
$THEOS/bin/nic.pl<br />
<br />
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.<br />
<br />
(If you get an error message saying "Illegal instruction: 4", [[Theos/Troubleshooting#Architecture_.28partial.29_incompatibility|see this troubleshooting advice]].)<br />
<br />
=== NIC Example ===<br />
<br />
Here is an example of what you will see when using the NIC to create a project (with user input shown in bold):<br />
<br />
$ '''$THEOS/bin/nic.pl'''<br />
NIC 1.0 - New Instance Creator<br />
------------------------------<br />
[1.] iphone/application<br />
[2.] iphone/library<br />
[3.] iphone/preference_bundle<br />
[4.] iphone/tool<br />
[5.] iphone/tweak<br />
Choose a Template (required): '''1'''<br />
Project Name (required): '''iPhoneDevWiki'''<br />
Package Name [com.yourcompany.iphonedevwiki]: '''net.howett.iphonedevwiki'''<br />
Authour/Maintainer Name [Dustin L. Howett]: <br />
Instantiating iphone/application in iphonedevwiki/...<br />
Done.<br />
$<br />
<br />
The above will create a folder <tt>./iphonedevwiki</tt> in the current working directory - make sure you have permissions to create a folder.<br />
<br />
== Making your Project ==<br />
<br />
When you have finished developing your tweak/app, you may want to distribute it, either to your own device, or to an external source.<br />
<br />
When you are making the project, type this in the terminal, in your project folder:<br />
<br />
$ make package <br />
<br />
This will generate a .deb file, which you can distribute to people or to repositories.<br />
<br />
If you want to install the latest package, type:<br />
<br />
$ make install<br />
<br />
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).<br />
<br />
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.<br />
<br />
If you are developing an application, you need to force the icon cache to be reloaded for your app's icon to show up. Restarting SpringBoard is not effective, since this does not rebuild the cache. Simply run:<br />
<br />
$ uicache<br />
<br />
== Further Reading ==<br />
<br />
You can learn how to do Makefiles with theos on http://uv.howett.net/ipf.html. Start over there.<br />
<br />
For general advice on beginning development for jailbroken iOS, see [[Getting Started]].<br />
<br />
== Getting Help ==<br />
<br />
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.<br />
<br />
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]].</div>The caslehttps://iphonedev.wiki/index.php?title=Theos/Setup&diff=4995Theos/Setup2017-06-01T03:06:37Z<p>The casle: /* OUTDATED GO TO LINK ABOVE PLEASE GUYS */</p>
<hr />
<div>{{Warning | This article is BEING UPDATED, please read [https://github.com/theos/theos/wiki/Installation these instructions instead]. }}<br />
<br />
This page contains instructions for installing [[Theos]] and preparing a new project.<br />
<br />
== Definitions ==<br />
===='''OUTDATED GO TO LINK ABOVE PLEASE GUYS'''====<br />
<code>$THEOS</code> 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.<br />
<br />
Typically, the location of Theos one of these:<br />
<br />
* <tt>/opt/theos</tt>, on OS X or Linux<br />
* <tt>/var/theos</tt>, on iOS<br />
* <tt>~/theos</tt>, if you don't have permission to install Theos to one of the above<br />
<br />
== Requirements ==<br />
<br />
* 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:<br />
** curl<br />
** git<br />
** make<br />
** openssh<br />
** perl<br />
** rsync<br />
** dpkg (port or homebrew install on Mac OS X)<br />
** python (if on Windows)<br />
* Some form of a toolchain or official SDK<br />
* Cydia [http://apt.saurik.com/debs/ mobilesubstrate]<br />
* Access to a terminal emulator and some knowledge of how to use it<br />
* '''Objective-C knowledge'''<br />
<br />
More detailed explanations of these requirements are given in the next section, and are dependent on the environment you use.<br />
<br />
(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. [http://ryanstutorials.net/linuxtutorial/ 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.)<br />
<br />
== Setting Up Dependencies ==<br />
<br />
=== For Mac OS X ===<br />
<br />
Mac OS X comes with most of the necessary tools (subversion, curl, and perl) by default.<br />
<br />
You will still need compilation tools and the iOS SDK, and the easiest way to obtain both of these is by installing Xcode from [https://itunes.apple.com/app/xcode/id497799835?mt=12 the App Store].<br />
<br />
Install dpkg via your installed package manager, which might be either <code>[http://brew.sh/ brew] install dpkg</code> or <code>[https://www.macports.org/ port] install dpkg</code>.<br />
<br />
Your package manager may also have [[ldid]]. Fink and Homebrew do. If not, compile and install it yourself:<br />
<br />
<pre>git clone git://git.saurik.com/ldid.git<br />
cd ldid<br />
git submodule update --init<br />
./make.sh<br />
cp -f ./ldid $THEOS/bin/ldid</pre><br />
<br />
Or download from one of these sources:<br />
<br />
* http://joedj.net/ldid<br />
* http://jontelang.com/guide/chapter2/ldid.html<br />
<br />
=== For Linux ===<br />
<br />
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:<br />
<pre>sudo apt-get install git perl curl</pre><br />
<br />
If your distro uses RPM, the process is very similar.<br />
<br />
Ensure you have dpkg and ldid (see above).<br />
<br />
=== For iOS ===<br />
<br />
'''Dependencies:'''<br />
<br />
Theos as a package depends on bash, grep, dpkg, coreutils, ldid, rsync and make, so the utilities mentioned in the requirements are automatically installed.<br />
<br />
'''Install a Toolchain:''' <br />
<br />
See [[On-device toolchains]] for details.<br />
<br />
=== For Windows ===<br />
<br />
''To do: cygwin, perl, python. Use [http://coolstar.org/theos.pdf this].''<br />
<br />
== Installing Theos ==<br />
<br />
=== On Mac OS X or Linux ===<br />
<br />
# Open a terminal window.<br />
# Choose a location for Theos to be installed. If you are unsure, a good choice is <tt>/opt/theos</tt>.<pre>export THEOS=/opt/theos</pre><br />
#* 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.<br />
# Download the latest version of Theos:<br />
#* Using git: <pre>git clone --recursive git://github.com/theos/theos.git $THEOS</pre><br />
# Add Theos environment variables to your <code>~/.bash_profile</code> (or the equivalent for your shell). Open <code>~/.bash_profile</code> (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: <!-- this bit of text is borrowed from http://sharedinstance.net/2013/12/build-on-windows/ with permission, thanks kirb! --><br><pre>export THEOS=/opt/theos&#10;export PATH=$THEOS/bin:$PATH&#10;export THEOS_DEVICE_IP=example.local THEOS_DEVICE_PORT=22</pre>Load this into the shell with <code>. ~/.bash_profile</code>, or close the terminal window and launch a new one.<br />
# As the Substrate library does not come installed on these platforms nor bundled with Theos, copy <code>/Library/Frameworks/CydiaSubstrate.framework/CydiaSubstrate</code> from the device to your local <code>$THEOS/lib</code> folder and rename it to <code>libsubstrate.dylib</code>. (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 [[Theos/Troubleshooting#Missing_Substrate_library|one of these error messages]]). Similarly, copy <code>/Library/Frameworks/CydiaSubstrate.framework/Headers/CydiaSubstrate.h</code> to your local <code>$THEOS/include</code> folder and rename it to <code>substrate.h</code>. You can alternatively retrieve files directly from the package: <pre>wget http://apt.saurik.com/debs/mobilesubstrate_0.9.6011_iphoneos-arm.deb&#10;mkdir substrate&#10;dpkg-deb -x mobilesubstrate_*_iphoneos-arm.deb substrate&#10;mv substrate/Library/Frameworks/CydiaSubstrate.framework/CydiaSubstrate $THEOS/lib/libsubstrate.dylib&#10;mv substrate/Library/Frameworks/CydiaSubstrate.framework/Headers/CydiaSubstrate.h $THEOS/include/substrate.h</pre><br />
<br />
=== On iOS ===<br />
<br />
Follow the instructions [[Theos/Setup/iOS | here]].<br />
<br />
=== On Windows ===<br />
<br />
''To do. Use [http://coolstar.org/theos.pdf this].''<br />
<br />
=== Also for Linux and iOS (and other operating systems other than Mac OS X): Retrieving SDKs ===<br />
<br />
If you aren't using OS X, you must download an iOS SDK. See [[Retrieving SDKs]] for details on this.<br />
<br />
Take the SDK and put it in <code>$THEOS/sdks</code> (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.<br />
<br />
Each SDK folder should have these folders: Developer, System, usr; and these files: ResourceRules.plist, Entitlements.plist, SDKSettings.plist.<br />
<br />
Note that if no SDKs are provided, the following error will be displayed (also noted in the [[Theos/Troubleshooting|Troubleshooting page]]): <pre>".../theos/makefiles/targets/darwin-arm/iphone.mk:21: *** first argument to 'word' function must be greater than 0. stop."</pre><br />
<br />
== Creating a Project ==<br />
<br />
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:<br />
<br />
$THEOS/bin/nic.pl<br />
<br />
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.<br />
<br />
(If you get an error message saying "Illegal instruction: 4", [[Theos/Troubleshooting#Architecture_.28partial.29_incompatibility|see this troubleshooting advice]].)<br />
<br />
=== NIC Example ===<br />
<br />
Here is an example of what you will see when using the NIC to create a project (with user input shown in bold):<br />
<br />
$ '''$THEOS/bin/nic.pl'''<br />
NIC 1.0 - New Instance Creator<br />
------------------------------<br />
[1.] iphone/application<br />
[2.] iphone/library<br />
[3.] iphone/preference_bundle<br />
[4.] iphone/tool<br />
[5.] iphone/tweak<br />
Choose a Template (required): '''1'''<br />
Project Name (required): '''iPhoneDevWiki'''<br />
Package Name [com.yourcompany.iphonedevwiki]: '''net.howett.iphonedevwiki'''<br />
Authour/Maintainer Name [Dustin L. Howett]: <br />
Instantiating iphone/application in iphonedevwiki/...<br />
Done.<br />
$<br />
<br />
The above will create a folder <tt>./iphonedevwiki</tt> in the current working directory - make sure you have permissions to create a folder.<br />
<br />
== Making your Project ==<br />
<br />
When you have finished developing your tweak/app, you may want to distribute it, either to your own device, or to an external source.<br />
<br />
When you are making the project, type this in the terminal, in your project folder:<br />
<br />
$ make package <br />
<br />
This will generate a .deb file, which you can distribute to people or to repositories.<br />
<br />
If you want to install the latest package, type:<br />
<br />
$ make install<br />
<br />
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).<br />
<br />
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.<br />
<br />
If you are developing an application, you need to force the icon cache to be reloaded for your app's icon to show up. Restarting SpringBoard is not effective, since this does not rebuild the cache. Simply run:<br />
<br />
$ uicache<br />
<br />
== Further Reading ==<br />
<br />
You can learn how to do Makefiles with theos on http://uv.howett.net/ipf.html. Start over there.<br />
<br />
For general advice on beginning development for jailbroken iOS, see [[Getting Started]].<br />
<br />
== Getting Help ==<br />
<br />
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.<br />
<br />
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]].</div>The caslehttps://iphonedev.wiki/index.php?title=Theos/Setup&diff=4994Theos/Setup2017-06-01T03:05:34Z<p>The casle: </p>
<hr />
<div>{{Warning | This article is BEING UPDATED, please read [https://github.com/theos/theos/wiki/Installation these instructions instead]. }}<br />
<br />
This page contains instructions for installing [[Theos]] and preparing a new project.<br />
<br />
== Definitions ==<br />
==='''OUTDATED GO TO LINK ABOVE PLEASE GUYS'''===<br />
<code>$THEOS</code> 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.<br />
<br />
Typically, the location of Theos one of these:<br />
<br />
* <tt>/opt/theos</tt>, on OS X or Linux<br />
* <tt>/var/theos</tt>, on iOS<br />
* <tt>~/theos</tt>, if you don't have permission to install Theos to one of the above<br />
<br />
== Requirements ==<br />
<br />
* 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:<br />
** curl<br />
** git<br />
** make<br />
** openssh<br />
** perl<br />
** rsync<br />
** dpkg (port or homebrew install on Mac OS X)<br />
** python (if on Windows)<br />
* Some form of a toolchain or official SDK<br />
* Cydia [http://apt.saurik.com/debs/ mobilesubstrate]<br />
* Access to a terminal emulator and some knowledge of how to use it<br />
* '''Objective-C knowledge'''<br />
<br />
More detailed explanations of these requirements are given in the next section, and are dependent on the environment you use.<br />
<br />
(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. [http://ryanstutorials.net/linuxtutorial/ 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.)<br />
<br />
== Setting Up Dependencies ==<br />
<br />
=== For Mac OS X ===<br />
<br />
Mac OS X comes with most of the necessary tools (subversion, curl, and perl) by default.<br />
<br />
You will still need compilation tools and the iOS SDK, and the easiest way to obtain both of these is by installing Xcode from [https://itunes.apple.com/app/xcode/id497799835?mt=12 the App Store].<br />
<br />
Install dpkg via your installed package manager, which might be either <code>[http://brew.sh/ brew] install dpkg</code> or <code>[https://www.macports.org/ port] install dpkg</code>.<br />
<br />
Your package manager may also have [[ldid]]. Fink and Homebrew do. If not, compile and install it yourself:<br />
<br />
<pre>git clone git://git.saurik.com/ldid.git<br />
cd ldid<br />
git submodule update --init<br />
./make.sh<br />
cp -f ./ldid $THEOS/bin/ldid</pre><br />
<br />
Or download from one of these sources:<br />
<br />
* http://joedj.net/ldid<br />
* http://jontelang.com/guide/chapter2/ldid.html<br />
<br />
=== For Linux ===<br />
<br />
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:<br />
<pre>sudo apt-get install git perl curl</pre><br />
<br />
If your distro uses RPM, the process is very similar.<br />
<br />
Ensure you have dpkg and ldid (see above).<br />
<br />
=== For iOS ===<br />
<br />
'''Dependencies:'''<br />
<br />
Theos as a package depends on bash, grep, dpkg, coreutils, ldid, rsync and make, so the utilities mentioned in the requirements are automatically installed.<br />
<br />
'''Install a Toolchain:''' <br />
<br />
See [[On-device toolchains]] for details.<br />
<br />
=== For Windows ===<br />
<br />
''To do: cygwin, perl, python. Use [http://coolstar.org/theos.pdf this].''<br />
<br />
== Installing Theos ==<br />
<br />
=== On Mac OS X or Linux ===<br />
<br />
# Open a terminal window.<br />
# Choose a location for Theos to be installed. If you are unsure, a good choice is <tt>/opt/theos</tt>.<pre>export THEOS=/opt/theos</pre><br />
#* 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.<br />
# Download the latest version of Theos:<br />
#* Using git: <pre>git clone --recursive git://github.com/theos/theos.git $THEOS</pre><br />
# Add Theos environment variables to your <code>~/.bash_profile</code> (or the equivalent for your shell). Open <code>~/.bash_profile</code> (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: <!-- this bit of text is borrowed from http://sharedinstance.net/2013/12/build-on-windows/ with permission, thanks kirb! --><br><pre>export THEOS=/opt/theos&#10;export PATH=$THEOS/bin:$PATH&#10;export THEOS_DEVICE_IP=example.local THEOS_DEVICE_PORT=22</pre>Load this into the shell with <code>. ~/.bash_profile</code>, or close the terminal window and launch a new one.<br />
# As the Substrate library does not come installed on these platforms nor bundled with Theos, copy <code>/Library/Frameworks/CydiaSubstrate.framework/CydiaSubstrate</code> from the device to your local <code>$THEOS/lib</code> folder and rename it to <code>libsubstrate.dylib</code>. (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 [[Theos/Troubleshooting#Missing_Substrate_library|one of these error messages]]). Similarly, copy <code>/Library/Frameworks/CydiaSubstrate.framework/Headers/CydiaSubstrate.h</code> to your local <code>$THEOS/include</code> folder and rename it to <code>substrate.h</code>. You can alternatively retrieve files directly from the package: <pre>wget http://apt.saurik.com/debs/mobilesubstrate_0.9.6011_iphoneos-arm.deb&#10;mkdir substrate&#10;dpkg-deb -x mobilesubstrate_*_iphoneos-arm.deb substrate&#10;mv substrate/Library/Frameworks/CydiaSubstrate.framework/CydiaSubstrate $THEOS/lib/libsubstrate.dylib&#10;mv substrate/Library/Frameworks/CydiaSubstrate.framework/Headers/CydiaSubstrate.h $THEOS/include/substrate.h</pre><br />
<br />
=== On iOS ===<br />
<br />
Follow the instructions [[Theos/Setup/iOS | here]].<br />
<br />
=== On Windows ===<br />
<br />
''To do. Use [http://coolstar.org/theos.pdf this].''<br />
<br />
=== Also for Linux and iOS (and other operating systems other than Mac OS X): Retrieving SDKs ===<br />
<br />
If you aren't using OS X, you must download an iOS SDK. See [[Retrieving SDKs]] for details on this.<br />
<br />
Take the SDK and put it in <code>$THEOS/sdks</code> (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.<br />
<br />
Each SDK folder should have these folders: Developer, System, usr; and these files: ResourceRules.plist, Entitlements.plist, SDKSettings.plist.<br />
<br />
Note that if no SDKs are provided, the following error will be displayed (also noted in the [[Theos/Troubleshooting|Troubleshooting page]]): <pre>".../theos/makefiles/targets/darwin-arm/iphone.mk:21: *** first argument to 'word' function must be greater than 0. stop."</pre><br />
<br />
== Creating a Project ==<br />
<br />
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:<br />
<br />
$THEOS/bin/nic.pl<br />
<br />
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.<br />
<br />
(If you get an error message saying "Illegal instruction: 4", [[Theos/Troubleshooting#Architecture_.28partial.29_incompatibility|see this troubleshooting advice]].)<br />
<br />
=== NIC Example ===<br />
<br />
Here is an example of what you will see when using the NIC to create a project (with user input shown in bold):<br />
<br />
$ '''$THEOS/bin/nic.pl'''<br />
NIC 1.0 - New Instance Creator<br />
------------------------------<br />
[1.] iphone/application<br />
[2.] iphone/library<br />
[3.] iphone/preference_bundle<br />
[4.] iphone/tool<br />
[5.] iphone/tweak<br />
Choose a Template (required): '''1'''<br />
Project Name (required): '''iPhoneDevWiki'''<br />
Package Name [com.yourcompany.iphonedevwiki]: '''net.howett.iphonedevwiki'''<br />
Authour/Maintainer Name [Dustin L. Howett]: <br />
Instantiating iphone/application in iphonedevwiki/...<br />
Done.<br />
$<br />
<br />
The above will create a folder <tt>./iphonedevwiki</tt> in the current working directory - make sure you have permissions to create a folder.<br />
<br />
== Making your Project ==<br />
<br />
When you have finished developing your tweak/app, you may want to distribute it, either to your own device, or to an external source.<br />
<br />
When you are making the project, type this in the terminal, in your project folder:<br />
<br />
$ make package <br />
<br />
This will generate a .deb file, which you can distribute to people or to repositories.<br />
<br />
If you want to install the latest package, type:<br />
<br />
$ make install<br />
<br />
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).<br />
<br />
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.<br />
<br />
If you are developing an application, you need to force the icon cache to be reloaded for your app's icon to show up. Restarting SpringBoard is not effective, since this does not rebuild the cache. Simply run:<br />
<br />
$ uicache<br />
<br />
== Further Reading ==<br />
<br />
You can learn how to do Makefiles with theos on http://uv.howett.net/ipf.html. Start over there.<br />
<br />
For general advice on beginning development for jailbroken iOS, see [[Getting Started]].<br />
<br />
== Getting Help ==<br />
<br />
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.<br />
<br />
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]].</div>The caslehttps://iphonedev.wiki/index.php?title=Theos/Setup/iOS&diff=4981Theos/Setup/iOS2017-04-28T03:18:58Z<p>The casle: </p>
<hr />
<div>This page is for setting up Theos on an iOS Device. For other platforms see [[Theos/Setup]].<br />
<br />
[https://github.com/theos/theos/wiki/Installation This] is the official tutorial, but I simplified to only iOS. Simply run the following command:<br />
<br />
<pre>git clone --recursive https://github.com/theos/theos.git /var/theos</pre><br />
<br />
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 <br />
<br />
<pre> /var/theos/sdks</pre><br />
<br />
And it should look like<br />
<br />
<pre> /var/theos/sdks/iPhoneOS9.3.sdk</pre><br />
<br />
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<br />
<br />
<pre>export THEOS=/var/theos&#10;alias theos=’/var/theos/bin/nic.pl’</pre><br />
<br />
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.<br />
<br />
<pre> cd /User/Documents/Development</pre><br />
<br />
Once there run your newly created alias called <br />
<br />
<pre>theos</pre><br />
<br />
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<br />
<br />
<pre> cd blank/</pre><br />
<br />
You should be able to run<br />
<br />
<pre>make package install</pre><br />
<br />
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),<br />
<br />
<pre>make update-theos</pre> <br />
<br />
<br />
== Requirements ==<br />
<br />
* A jailbroken iOS device with Cydia (or another package manager) installed.<br />
* Knowledge on how to use a command line terminal.<br />
* Objective C knowledge.<br />
<br />
=== Optional Requirements ===<br />
<br />
* OpenSSH installed on your device and a computer that you can SSH into your device with (using MobileTerminal gets tedious pretty quickly).<br />
<br />
== Installing Theos and it's dependencies ==<br />
<br />
# Add the following repositories to your Cydia sources.<br />
#* http://coolstar.org/publicrepo<br />
#* http://nix.howett.net/theos<br />
# Install the following packages in Cydia:<br />
#* <code>Perl</code><br />
#* <code>Theos</code><br />
#* <code>iOS Toolchain</code><br />
# Check that Theos is installed on your device by running: <pre>echo $THEOS</pre><br />The output should be: <code>/var/theos</code><br />
<br />
== Setting up the iOS SDK ==<br />
<br />
Navigate to https://sdks.website and check which iOS SDK you wish to download.<br />
<br />
# Create a directory for the SDK to be placed in: <pre>mkdir -p $THEOS/sdks</pre><br />
# Download the SDK temporarily and extract to the SDK directory: <pre>curl -ksL "https://sdks.website/dl/iPhoneOSX.Y.sdk.tbz2" | tar -xj -C $THEOS/sdks</pre><br>''X.Y being the version numbers of the SDK, as seen in https://sdks.website/.''<br />
<br />
== Additional Step for 64 bit (ARM64) Devices ==<br />
<br />
With the current version of Theos (0.9.639-1), building on ARM64 will throw an error. The following will solve this issue.<br />
<br />
# Create symlinks to support ARM64: <pre>ln -s $THEOS/makefiles/platform/Darwin-arm.mk $THEOS/makefiles/platform/Darwin-arm64.mk&#10;ln -s $THEOS/makefiles/targets/Darwin-arm $THEOS/makefiles/targets/Darwin-arm64</pre><br />
<br />
== Complete Text Tutorial by iOSChris ==<br />
<br />
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:<br />
* http://chrisharrisdev.com/blog/2016/09/22/tutorial-install-theos-on-idevice-for-jailbreak-development/</div>The caslehttps://iphonedev.wiki/index.php?title=Theos/Setup/iOS&diff=4980Theos/Setup/iOS2017-04-28T03:18:39Z<p>The casle: </p>
<hr />
<div>This page is for setting up Theos on an iOS Device. For other platforms see [[Theos/Setup]].<br />
[https://github.com/theos/theos/wiki/Installation This] is the official tutorial, but I simplified to only iOS. Simply run the following command:<br />
<br />
<pre>git clone --recursive https://github.com/theos/theos.git /var/theos</pre><br />
<br />
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 <br />
<br />
<pre> /var/theos/sdks</pre><br />
<br />
And it should look like<br />
<br />
<pre> /var/theos/sdks/iPhoneOS9.3.sdk</pre><br />
<br />
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<br />
<br />
<pre>export THEOS=/var/theos&#10;alias theos=’/var/theos/bin/nic.pl’</pre><br />
<br />
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.<br />
<br />
<pre> cd /User/Documents/Development</pre><br />
<br />
Once there run your newly created alias called <br />
<br />
<pre>theos</pre><br />
<br />
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<br />
<br />
<pre> cd blank/</pre><br />
<br />
You should be able to run<br />
<br />
<pre>make package install</pre><br />
<br />
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),<br />
<br />
<pre>make update-theos</pre> <br />
<br />
<br />
== Requirements ==<br />
<br />
* A jailbroken iOS device with Cydia (or another package manager) installed.<br />
* Knowledge on how to use a command line terminal.<br />
* Objective C knowledge.<br />
<br />
=== Optional Requirements ===<br />
<br />
* OpenSSH installed on your device and a computer that you can SSH into your device with (using MobileTerminal gets tedious pretty quickly).<br />
<br />
== Installing Theos and it's dependencies ==<br />
<br />
# Add the following repositories to your Cydia sources.<br />
#* http://coolstar.org/publicrepo<br />
#* http://nix.howett.net/theos<br />
# Install the following packages in Cydia:<br />
#* <code>Perl</code><br />
#* <code>Theos</code><br />
#* <code>iOS Toolchain</code><br />
# Check that Theos is installed on your device by running: <pre>echo $THEOS</pre><br />The output should be: <code>/var/theos</code><br />
<br />
== Setting up the iOS SDK ==<br />
<br />
Navigate to https://sdks.website and check which iOS SDK you wish to download.<br />
<br />
# Create a directory for the SDK to be placed in: <pre>mkdir -p $THEOS/sdks</pre><br />
# Download the SDK temporarily and extract to the SDK directory: <pre>curl -ksL "https://sdks.website/dl/iPhoneOSX.Y.sdk.tbz2" | tar -xj -C $THEOS/sdks</pre><br>''X.Y being the version numbers of the SDK, as seen in https://sdks.website/.''<br />
<br />
== Additional Step for 64 bit (ARM64) Devices ==<br />
<br />
With the current version of Theos (0.9.639-1), building on ARM64 will throw an error. The following will solve this issue.<br />
<br />
# Create symlinks to support ARM64: <pre>ln -s $THEOS/makefiles/platform/Darwin-arm.mk $THEOS/makefiles/platform/Darwin-arm64.mk&#10;ln -s $THEOS/makefiles/targets/Darwin-arm $THEOS/makefiles/targets/Darwin-arm64</pre><br />
<br />
== Complete Text Tutorial by iOSChris ==<br />
<br />
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:<br />
* http://chrisharrisdev.com/blog/2016/09/22/tutorial-install-theos-on-idevice-for-jailbreak-development/</div>The caslehttps://iphonedev.wiki/index.php?title=Theos/Setup/iOS&diff=4979Theos/Setup/iOS2017-04-28T03:17:14Z<p>The casle: </p>
<hr />
<div>This page is for setting up Theos on an iOS Device. For other platforms see [[Theos/Setup]].<br />
[https://github.com/theos/theos/wiki/Installation This] is the official tutorial, but I simplified to only iOS. Simply run the following command:<br />
<br />
<pre>git clone --recursive https://github.com/theos/theos.git /var/theos</pre><br />
<br />
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 <br />
<br />
<pre> /var/theos/sdks</pre><br />
<br />
And it should look like<br />
<br />
<pre> /var/theos/sdks/iPhoneOS9.3.sdk</pre><br />
<br />
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<br />
<br />
<pre>export THEOS=/var/theos;alias theos=’/var/theos/bin/nic.pl’</pre><br />
<br />
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.<br />
<br />
<pre> cd /User/Documents/Development</pre><br />
<br />
Once there run your newly created alias called <br />
<br />
<pre>theos</pre><br />
<br />
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<br />
<br />
<pre> cd blank/</pre><br />
<br />
You should be able to run<br />
<br />
<pre>make package install</pre><br />
<br />
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),<br />
<br />
<pre>make update-theos</pre> <br />
<br />
<br />
== Requirements ==<br />
<br />
* A jailbroken iOS device with Cydia (or another package manager) installed.<br />
* Knowledge on how to use a command line terminal.<br />
* Objective C knowledge.<br />
<br />
=== Optional Requirements ===<br />
<br />
* OpenSSH installed on your device and a computer that you can SSH into your device with (using MobileTerminal gets tedious pretty quickly).<br />
<br />
== Installing Theos and it's dependencies ==<br />
<br />
# Add the following repositories to your Cydia sources.<br />
#* http://coolstar.org/publicrepo<br />
#* http://nix.howett.net/theos<br />
# Install the following packages in Cydia:<br />
#* <code>Perl</code><br />
#* <code>Theos</code><br />
#* <code>iOS Toolchain</code><br />
# Check that Theos is installed on your device by running: <pre>echo $THEOS</pre><br />The output should be: <code>/var/theos</code><br />
<br />
== Setting up the iOS SDK ==<br />
<br />
Navigate to https://sdks.website and check which iOS SDK you wish to download.<br />
<br />
# Create a directory for the SDK to be placed in: <pre>mkdir -p $THEOS/sdks</pre><br />
# Download the SDK temporarily and extract to the SDK directory: <pre>curl -ksL "https://sdks.website/dl/iPhoneOSX.Y.sdk.tbz2" | tar -xj -C $THEOS/sdks</pre><br>''X.Y being the version numbers of the SDK, as seen in https://sdks.website/.''<br />
<br />
== Additional Step for 64 bit (ARM64) Devices ==<br />
<br />
With the current version of Theos (0.9.639-1), building on ARM64 will throw an error. The following will solve this issue.<br />
<br />
# Create symlinks to support ARM64: <pre>ln -s $THEOS/makefiles/platform/Darwin-arm.mk $THEOS/makefiles/platform/Darwin-arm64.mk&#10;ln -s $THEOS/makefiles/targets/Darwin-arm $THEOS/makefiles/targets/Darwin-arm64</pre><br />
<br />
== Complete Text Tutorial by iOSChris ==<br />
<br />
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:<br />
* http://chrisharrisdev.com/blog/2016/09/22/tutorial-install-theos-on-idevice-for-jailbreak-development/</div>The caslehttps://iphonedev.wiki/index.php?title=Theos/Setup/iOS&diff=4978Theos/Setup/iOS2017-04-28T03:15:07Z<p>The casle: UPDATES</p>
<hr />
<div>This page is for setting up Theos on an iOS Device. For other platforms see [[Theos/Setup]].<br />
[https://github.com/theos/theos/wiki/Installation This] is the official tutorial, but I simplified to only iOS. Simply run the following command:<br />
<br />
<pre>git clone --recursive https://github.com/theos/theos.git /var/theos</pre><br />
<br />
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 <br />
<br />
<pre /var/theos/sdks</pre><br />
<br />
And it should look like<br />
<br />
<pre> /var/theos/sdks/iPhoneOS9.3.sdk</pre><br />
<br />
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<br />
<br />
<pre>export THEOS=/var/theos;alias theos=’/var/theos/bin/nic.pl’</pre><br />
<br />
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.<br />
<br />
<pre> cd /User/Documents/Development</pre><br />
<br />
Once there run your newly created alias called <br />
<br />
<pre>theos</pre><br />
<br />
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<br />
<br />
<pre> cd blank/</pre><br />
<br />
You should be able to run<br />
<br />
<pre>make package install</pre><br />
<br />
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),<br />
<br />
<premake update-theos</pre> <br />
<br />
<br />
== Requirements ==<br />
<br />
* A jailbroken iOS device with Cydia (or another package manager) installed.<br />
* Knowledge on how to use a command line terminal.<br />
* Objective C knowledge.<br />
<br />
=== Optional Requirements ===<br />
<br />
* OpenSSH installed on your device and a computer that you can SSH into your device with (using MobileTerminal gets tedious pretty quickly).<br />
<br />
== Installing Theos and it's dependencies ==<br />
<br />
# Add the following repositories to your Cydia sources.<br />
#* http://coolstar.org/publicrepo<br />
#* http://nix.howett.net/theos<br />
# Install the following packages in Cydia:<br />
#* <code>Perl</code><br />
#* <code>Theos</code><br />
#* <code>iOS Toolchain</code><br />
# Check that Theos is installed on your device by running: <pre>echo $THEOS</pre><br />The output should be: <code>/var/theos</code><br />
<br />
== Setting up the iOS SDK ==<br />
<br />
Navigate to https://sdks.website and check which iOS SDK you wish to download.<br />
<br />
# Create a directory for the SDK to be placed in: <pre>mkdir -p $THEOS/sdks</pre><br />
# Download the SDK temporarily and extract to the SDK directory: <pre>curl -ksL "https://sdks.website/dl/iPhoneOSX.Y.sdk.tbz2" | tar -xj -C $THEOS/sdks</pre><br>''X.Y being the version numbers of the SDK, as seen in https://sdks.website/.''<br />
<br />
== Additional Step for 64 bit (ARM64) Devices ==<br />
<br />
With the current version of Theos (0.9.639-1), building on ARM64 will throw an error. The following will solve this issue.<br />
<br />
# Create symlinks to support ARM64: <pre>ln -s $THEOS/makefiles/platform/Darwin-arm.mk $THEOS/makefiles/platform/Darwin-arm64.mk&#10;ln -s $THEOS/makefiles/targets/Darwin-arm $THEOS/makefiles/targets/Darwin-arm64</pre><br />
<br />
== Complete Text Tutorial by iOSChris ==<br />
<br />
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:<br />
* http://chrisharrisdev.com/blog/2016/09/22/tutorial-install-theos-on-idevice-for-jailbreak-development/</div>The caslehttps://iphonedev.wiki/index.php?title=Theos/Setup&diff=4977Theos/Setup2017-04-28T02:59:08Z<p>The casle: </p>
<hr />
<div>{{Warning | This article is BEING UPDATED, please read [https://github.com/theos/theos/wiki/Installation these instructions instead]. }}<br />
<br />
This page contains instructions for installing [[Theos]] and preparing a new project.<br />
<br />
== Definitions ==<br />
<br />
<code>$THEOS</code> 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.<br />
<br />
Typically, the location of Theos one of these:<br />
<br />
* <tt>/opt/theos</tt>, on OS X or Linux<br />
* <tt>/var/theos</tt>, on iOS<br />
* <tt>~/theos</tt>, if you don't have permission to install Theos to one of the above<br />
<br />
== Requirements ==<br />
<br />
* 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:<br />
** curl<br />
** git<br />
** make<br />
** openssh<br />
** perl<br />
** rsync<br />
** dpkg (port or homebrew install on Mac OS X)<br />
** python (if on Windows)<br />
* Some form of a toolchain or official SDK<br />
* Cydia [http://apt.saurik.com/debs/ mobilesubstrate]<br />
* Access to a terminal emulator and some knowledge of how to use it<br />
* '''Objective-C knowledge'''<br />
<br />
More detailed explanations of these requirements are given in the next section, and are dependent on the environment you use.<br />
<br />
(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. [http://ryanstutorials.net/linuxtutorial/ 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.)<br />
<br />
== Setting Up Dependencies ==<br />
<br />
=== For Mac OS X ===<br />
<br />
Mac OS X comes with most of the necessary tools (subversion, curl, and perl) by default.<br />
<br />
You will still need compilation tools and the iOS SDK, and the easiest way to obtain both of these is by installing Xcode from [https://itunes.apple.com/app/xcode/id497799835?mt=12 the App Store].<br />
<br />
Install dpkg via your installed package manager, which might be either <code>[http://brew.sh/ brew] install dpkg</code> or <code>[https://www.macports.org/ port] install dpkg</code>.<br />
<br />
Your package manager may also have [[ldid]]. Fink and Homebrew do. If not, compile and install it yourself:<br />
<br />
<pre>git clone git://git.saurik.com/ldid.git<br />
cd ldid<br />
git submodule update --init<br />
./make.sh<br />
cp -f ./ldid $THEOS/bin/ldid</pre><br />
<br />
Or download from one of these sources:<br />
<br />
* http://joedj.net/ldid<br />
* http://jontelang.com/guide/chapter2/ldid.html<br />
<br />
=== For Linux ===<br />
<br />
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:<br />
<pre>sudo apt-get install git perl curl</pre><br />
<br />
If your distro uses RPM, the process is very similar.<br />
<br />
Ensure you have dpkg and ldid (see above).<br />
<br />
=== For iOS ===<br />
<br />
'''Dependencies:'''<br />
<br />
Theos as a package depends on bash, grep, dpkg, coreutils, ldid, rsync and make, so the utilities mentioned in the requirements are automatically installed.<br />
<br />
'''Install a Toolchain:''' <br />
<br />
See [[On-device toolchains]] for details.<br />
<br />
=== For Windows ===<br />
<br />
''To do: cygwin, perl, python. Use [http://coolstar.org/theos.pdf this].''<br />
<br />
== Installing Theos ==<br />
<br />
=== On Mac OS X or Linux ===<br />
<br />
# Open a terminal window.<br />
# Choose a location for Theos to be installed. If you are unsure, a good choice is <tt>/opt/theos</tt>.<pre>export THEOS=/opt/theos</pre><br />
#* 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.<br />
# Download the latest version of Theos:<br />
#* Using git: <pre>git clone --recursive git://github.com/theos/theos.git $THEOS</pre><br />
# Add Theos environment variables to your <code>~/.bash_profile</code> (or the equivalent for your shell). Open <code>~/.bash_profile</code> (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: <!-- this bit of text is borrowed from http://sharedinstance.net/2013/12/build-on-windows/ with permission, thanks kirb! --><br><pre>export THEOS=/opt/theos&#10;export PATH=$THEOS/bin:$PATH&#10;export THEOS_DEVICE_IP=example.local THEOS_DEVICE_PORT=22</pre>Load this into the shell with <code>. ~/.bash_profile</code>, or close the terminal window and launch a new one.<br />
# As the Substrate library does not come installed on these platforms nor bundled with Theos, copy <code>/Library/Frameworks/CydiaSubstrate.framework/CydiaSubstrate</code> from the device to your local <code>$THEOS/lib</code> folder and rename it to <code>libsubstrate.dylib</code>. (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 [[Theos/Troubleshooting#Missing_Substrate_library|one of these error messages]]). Similarly, copy <code>/Library/Frameworks/CydiaSubstrate.framework/Headers/CydiaSubstrate.h</code> to your local <code>$THEOS/include</code> folder and rename it to <code>substrate.h</code>. You can alternatively retrieve files directly from the package: <pre>wget http://apt.saurik.com/debs/mobilesubstrate_0.9.6011_iphoneos-arm.deb&#10;mkdir substrate&#10;dpkg-deb -x mobilesubstrate_*_iphoneos-arm.deb substrate&#10;mv substrate/Library/Frameworks/CydiaSubstrate.framework/CydiaSubstrate $THEOS/lib/libsubstrate.dylib&#10;mv substrate/Library/Frameworks/CydiaSubstrate.framework/Headers/CydiaSubstrate.h $THEOS/include/substrate.h</pre><br />
<br />
=== On iOS ===<br />
<br />
Follow the instructions [[Theos/Setup/iOS | here]].<br />
<br />
=== On Windows ===<br />
<br />
''To do. Use [http://coolstar.org/theos.pdf this].''<br />
<br />
=== Also for Linux and iOS (and other operating systems other than Mac OS X): Retrieving SDKs ===<br />
<br />
If you aren't using OS X, you must download an iOS SDK. See [[Retrieving SDKs]] for details on this.<br />
<br />
Take the SDK and put it in <code>$THEOS/sdks</code> (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.<br />
<br />
Each SDK folder should have these folders: Developer, System, usr; and these files: ResourceRules.plist, Entitlements.plist, SDKSettings.plist.<br />
<br />
Note that if no SDKs are provided, the following error will be displayed (also noted in the [[Theos/Troubleshooting|Troubleshooting page]]): <pre>".../theos/makefiles/targets/darwin-arm/iphone.mk:21: *** first argument to 'word' function must be greater than 0. stop."</pre><br />
<br />
== Creating a Project ==<br />
<br />
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:<br />
<br />
$THEOS/bin/nic.pl<br />
<br />
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.<br />
<br />
(If you get an error message saying "Illegal instruction: 4", [[Theos/Troubleshooting#Architecture_.28partial.29_incompatibility|see this troubleshooting advice]].)<br />
<br />
=== NIC Example ===<br />
<br />
Here is an example of what you will see when using the NIC to create a project (with user input shown in bold):<br />
<br />
$ '''$THEOS/bin/nic.pl'''<br />
NIC 1.0 - New Instance Creator<br />
------------------------------<br />
[1.] iphone/application<br />
[2.] iphone/library<br />
[3.] iphone/preference_bundle<br />
[4.] iphone/tool<br />
[5.] iphone/tweak<br />
Choose a Template (required): '''1'''<br />
Project Name (required): '''iPhoneDevWiki'''<br />
Package Name [com.yourcompany.iphonedevwiki]: '''net.howett.iphonedevwiki'''<br />
Authour/Maintainer Name [Dustin L. Howett]: <br />
Instantiating iphone/application in iphonedevwiki/...<br />
Done.<br />
$<br />
<br />
The above will create a folder <tt>./iphonedevwiki</tt> in the current working directory - make sure you have permissions to create a folder.<br />
<br />
== Making your Project ==<br />
<br />
When you have finished developing your tweak/app, you may want to distribute it, either to your own device, or to an external source.<br />
<br />
When you are making the project, type this in the terminal, in your project folder:<br />
<br />
$ make package <br />
<br />
This will generate a .deb file, which you can distribute to people or to repositories.<br />
<br />
If you want to install the latest package, type:<br />
<br />
$ make install<br />
<br />
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).<br />
<br />
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.<br />
<br />
If you are developing an application, you need to force the icon cache to be reloaded for your app's icon to show up. Restarting SpringBoard is not effective, since this does not rebuild the cache. Simply run:<br />
<br />
$ uicache<br />
<br />
== Further Reading ==<br />
<br />
You can learn how to do Makefiles with theos on http://uv.howett.net/ipf.html. Start over there.<br />
<br />
For general advice on beginning development for jailbroken iOS, see [[Getting Started]].<br />
<br />
== Getting Help ==<br />
<br />
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.<br />
<br />
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]].</div>The caslehttps://iphonedev.wiki/index.php?title=Theos/Setup&diff=4976Theos/Setup2017-04-28T02:57:21Z<p>The casle: Updating page</p>
<hr />
<div>{{Warning | This article is BEING UPDATED, please read [https://github.com/theos/theos/wiki/Installation these instructions instead] if you are trying to setup Theos on your Mac . }}<br />
<br />
This page contains instructions for installing [[Theos]] and preparing a new project.<br />
<br />
== Definitions ==<br />
<br />
<code>$THEOS</code> 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.<br />
<br />
Typically, the location of Theos one of these:<br />
<br />
* <tt>/opt/theos</tt>, on OS X or Linux<br />
* <tt>/var/theos</tt>, on iOS<br />
* <tt>~/theos</tt>, if you don't have permission to install Theos to one of the above<br />
<br />
== Requirements ==<br />
<br />
* 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:<br />
** curl<br />
** git<br />
** make<br />
** openssh<br />
** perl<br />
** rsync<br />
** dpkg (port or homebrew install on Mac OS X)<br />
** python (if on Windows)<br />
* Some form of a toolchain or official SDK<br />
* Cydia [http://apt.saurik.com/debs/ mobilesubstrate]<br />
* Access to a terminal emulator and some knowledge of how to use it<br />
* '''Objective-C knowledge'''<br />
<br />
More detailed explanations of these requirements are given in the next section, and are dependent on the environment you use.<br />
<br />
(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. [http://ryanstutorials.net/linuxtutorial/ 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.)<br />
<br />
== Setting Up Dependencies ==<br />
<br />
=== For Mac OS X ===<br />
<br />
Mac OS X comes with most of the necessary tools (subversion, curl, and perl) by default.<br />
<br />
You will still need compilation tools and the iOS SDK, and the easiest way to obtain both of these is by installing Xcode from [https://itunes.apple.com/app/xcode/id497799835?mt=12 the App Store].<br />
<br />
Install dpkg via your installed package manager, which might be either <code>[http://brew.sh/ brew] install dpkg</code> or <code>[https://www.macports.org/ port] install dpkg</code>.<br />
<br />
Your package manager may also have [[ldid]]. Fink and Homebrew do. If not, compile and install it yourself:<br />
<br />
<pre>git clone git://git.saurik.com/ldid.git<br />
cd ldid<br />
git submodule update --init<br />
./make.sh<br />
cp -f ./ldid $THEOS/bin/ldid</pre><br />
<br />
Or download from one of these sources:<br />
<br />
* http://joedj.net/ldid<br />
* http://jontelang.com/guide/chapter2/ldid.html<br />
<br />
=== For Linux ===<br />
<br />
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:<br />
<pre>sudo apt-get install git perl curl</pre><br />
<br />
If your distro uses RPM, the process is very similar.<br />
<br />
Ensure you have dpkg and ldid (see above).<br />
<br />
=== For iOS ===<br />
<br />
'''Dependencies:'''<br />
<br />
Theos as a package depends on bash, grep, dpkg, coreutils, ldid, rsync and make, so the utilities mentioned in the requirements are automatically installed.<br />
<br />
'''Install a Toolchain:''' <br />
<br />
See [[On-device toolchains]] for details.<br />
<br />
=== For Windows ===<br />
<br />
''To do: cygwin, perl, python. Use [http://coolstar.org/theos.pdf this].''<br />
<br />
== Installing Theos ==<br />
<br />
=== On Mac OS X or Linux ===<br />
<br />
# Open a terminal window.<br />
# Choose a location for Theos to be installed. If you are unsure, a good choice is <tt>/opt/theos</tt>.<pre>export THEOS=/opt/theos</pre><br />
#* 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.<br />
# Download the latest version of Theos:<br />
#* Using git: <pre>git clone --recursive git://github.com/theos/theos.git $THEOS</pre><br />
# Add Theos environment variables to your <code>~/.bash_profile</code> (or the equivalent for your shell). Open <code>~/.bash_profile</code> (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: <!-- this bit of text is borrowed from http://sharedinstance.net/2013/12/build-on-windows/ with permission, thanks kirb! --><br><pre>export THEOS=/opt/theos&#10;export PATH=$THEOS/bin:$PATH&#10;export THEOS_DEVICE_IP=example.local THEOS_DEVICE_PORT=22</pre>Load this into the shell with <code>. ~/.bash_profile</code>, or close the terminal window and launch a new one.<br />
# As the Substrate library does not come installed on these platforms nor bundled with Theos, copy <code>/Library/Frameworks/CydiaSubstrate.framework/CydiaSubstrate</code> from the device to your local <code>$THEOS/lib</code> folder and rename it to <code>libsubstrate.dylib</code>. (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 [[Theos/Troubleshooting#Missing_Substrate_library|one of these error messages]]). Similarly, copy <code>/Library/Frameworks/CydiaSubstrate.framework/Headers/CydiaSubstrate.h</code> to your local <code>$THEOS/include</code> folder and rename it to <code>substrate.h</code>. You can alternatively retrieve files directly from the package: <pre>wget http://apt.saurik.com/debs/mobilesubstrate_0.9.6011_iphoneos-arm.deb&#10;mkdir substrate&#10;dpkg-deb -x mobilesubstrate_*_iphoneos-arm.deb substrate&#10;mv substrate/Library/Frameworks/CydiaSubstrate.framework/CydiaSubstrate $THEOS/lib/libsubstrate.dylib&#10;mv substrate/Library/Frameworks/CydiaSubstrate.framework/Headers/CydiaSubstrate.h $THEOS/include/substrate.h</pre><br />
<br />
=== On iOS ===<br />
<br />
Follow the instructions [[Theos/Setup/iOS | here]].<br />
<br />
=== On Windows ===<br />
<br />
''To do. Use [http://coolstar.org/theos.pdf this].''<br />
<br />
=== Also for Linux and iOS (and other operating systems other than Mac OS X): Retrieving SDKs ===<br />
<br />
If you aren't using OS X, you must download an iOS SDK. See [[Retrieving SDKs]] for details on this.<br />
<br />
Take the SDK and put it in <code>$THEOS/sdks</code> (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.<br />
<br />
Each SDK folder should have these folders: Developer, System, usr; and these files: ResourceRules.plist, Entitlements.plist, SDKSettings.plist.<br />
<br />
Note that if no SDKs are provided, the following error will be displayed (also noted in the [[Theos/Troubleshooting|Troubleshooting page]]): <pre>".../theos/makefiles/targets/darwin-arm/iphone.mk:21: *** first argument to 'word' function must be greater than 0. stop."</pre><br />
<br />
== Creating a Project ==<br />
<br />
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:<br />
<br />
$THEOS/bin/nic.pl<br />
<br />
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.<br />
<br />
(If you get an error message saying "Illegal instruction: 4", [[Theos/Troubleshooting#Architecture_.28partial.29_incompatibility|see this troubleshooting advice]].)<br />
<br />
=== NIC Example ===<br />
<br />
Here is an example of what you will see when using the NIC to create a project (with user input shown in bold):<br />
<br />
$ '''$THEOS/bin/nic.pl'''<br />
NIC 1.0 - New Instance Creator<br />
------------------------------<br />
[1.] iphone/application<br />
[2.] iphone/library<br />
[3.] iphone/preference_bundle<br />
[4.] iphone/tool<br />
[5.] iphone/tweak<br />
Choose a Template (required): '''1'''<br />
Project Name (required): '''iPhoneDevWiki'''<br />
Package Name [com.yourcompany.iphonedevwiki]: '''net.howett.iphonedevwiki'''<br />
Authour/Maintainer Name [Dustin L. Howett]: <br />
Instantiating iphone/application in iphonedevwiki/...<br />
Done.<br />
$<br />
<br />
The above will create a folder <tt>./iphonedevwiki</tt> in the current working directory - make sure you have permissions to create a folder.<br />
<br />
== Making your Project ==<br />
<br />
When you have finished developing your tweak/app, you may want to distribute it, either to your own device, or to an external source.<br />
<br />
When you are making the project, type this in the terminal, in your project folder:<br />
<br />
$ make package <br />
<br />
This will generate a .deb file, which you can distribute to people or to repositories.<br />
<br />
If you want to install the latest package, type:<br />
<br />
$ make install<br />
<br />
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).<br />
<br />
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.<br />
<br />
If you are developing an application, you need to force the icon cache to be reloaded for your app's icon to show up. Restarting SpringBoard is not effective, since this does not rebuild the cache. Simply run:<br />
<br />
$ uicache<br />
<br />
== Further Reading ==<br />
<br />
You can learn how to do Makefiles with theos on http://uv.howett.net/ipf.html. Start over there.<br />
<br />
For general advice on beginning development for jailbroken iOS, see [[Getting Started]].<br />
<br />
== Getting Help ==<br />
<br />
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.<br />
<br />
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]].</div>The casle