# New hack: running the PlexConnect python script on your jailbroken ATV2

**URL:** <https://forums.plex.tv/t/new-hack-running-the-plexconnect-python-script-on-your-jailbroken-atv2/36967>\
**Category:** Apps & Creations\
**Created:** [June 22, 2013, 7:49pm UTC](https://forums.plex.tv/t/new-hack-running-the-plexconnect-python-script-on-your-jailbroken-atv2/36967 "2013-06-22T19:49:06Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![f00b4r](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/f00b4r/32/768_2.png) [@f00b4r](https://forums.plex.tv/u/f00b4r)\
**Post date:** [June 22, 2013, 7:49pm UTC](https://forums.plex.tv/t/new-hack-running-the-plexconnect-python-script-on-your-jailbroken-atv2/36967/1 "2013-06-22T19:49:06Z")

</div>

For those of you running ATV2 devices with a jailbreak you now have another, **currently unsupported but tested as working** , option open to you.

&nbsp;

1. Grab this file:&nbsp;[https://yangapp.googlecode.com/files/python\_2.7.3-3\_iphoneos-arm.deb](https://yangapp.googlecode.com/files/python_2.7.3-3_iphoneos-arm.deb)
2. Transfer it to your ATV2
3. SSH into your ATV2
4. Install using:&nbsp;dpkg -i python\_2.7.3-3\_iphoneos-arm.deb
5. Run PlexConnect (remember you do not need sudo as you are already logged in as root)

The &nbsp;ATV2's host file could probably be altered so that you could disable the PlexConnect DNS server component but i have not really played around with it too much.

It does however open up more possibilities for a very portable media centre when daemon code and MyPlex support is added (you could take it anywhere and access your content, shared or otherwise).

&nbsp;

Have&nbsp;a play about and provide some feedback if you want :D

&nbsp;

---

<div class="post-metadata">

**Author:** ![alias\_rex](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/alias_rex/32/887_2.png) [@alias\_rex](https://forums.plex.tv/u/alias_rex)\
**Post date:** [June 22, 2013, 8:28pm UTC](https://forums.plex.tv/t/new-hack-running-the-plexconnect-python-script-on-your-jailbroken-atv2/36967/2 "2013-06-22T20:28:52Z")

</div>

What address do you set the Apple TV's DNS field to? 127.0.0.1?

And&nbsp;how much hard drive space will this consume on an Apple TV because I assume it needs to install Python, as well?

> For those of you running ATV2 devices with a jailbreak you now have another, **currently unsupported but tested as working** , option open to you.
> 
> 1. Grab this file:&nbsp;[https://yangapp.googlecode.com/files/python\_2.7.3-3\_iphoneos-arm.deb](https://yangapp.googlecode.com/files/python_2.7.3-3_iphoneos-arm.deb)
> 2. Transfer it to your ATV2
> 3. SSH into your ATV2
> 4. Install using:&nbsp;dpkg -i python\_2.7.3-3\_iphoneos-arm.deb
> 5. Run PlexConnect (remember you do not need sudo as you are already logged in as root)
> 
> The &nbsp;ATV2's host file could probably be altered so that you could disable the PlexConnect DNS server component but i have not really played around with it too much.
> 
> It does however open up more possibilities for a very portable media centre when daemon code and MyPlex support is added (you could take it anywhere and access your content, shared or otherwise).
> 
> Have&nbsp;a play about and provide some feedback if you want :D

---

<div class="post-metadata">

**Author:** ![f00b4r](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/f00b4r/32/768_2.png) [@f00b4r](https://forums.plex.tv/u/f00b4r)\
**Post date:** [June 22, 2013, 8:39pm UTC](https://forums.plex.tv/t/new-hack-running-the-plexconnect-python-script-on-your-jailbroken-atv2/36967/3 "2013-06-22T20:39:48Z")

</div>

I set the ATV's DNS to the IP of the ATV, although 127.0.0.1 will probably work as well.

It also works if you disable the PlexConnect DNS server and edit the ATV's host file to point trailers.apple.com to the IP of your PMS.

After further though though you should be careful with the host file route if you plan to ever move the ATV from your home network (using the PlexConnect DNS server will probably work as a portable solution when MyPlex is up and running).

Hard drive space should not be an issue.

---

<div class="post-metadata">

**Author:** ![alias\_rex](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/alias_rex/32/887_2.png) [@alias\_rex](https://forums.plex.tv/u/alias_rex)\
**Post date:** [June 22, 2013, 8:49pm UTC](https://forums.plex.tv/t/new-hack-running-the-plexconnect-python-script-on-your-jailbroken-atv2/36967/4 "2013-06-22T20:49:59Z")

</div>

Okay, cool. I'm going to try this out. Two more questions, though. To start it, you just ssh in and type "PlexConnect.py" but how do you stop it running? And how do you uninstall it? Can I just delete the .deb file and PlexConnect folder or does it install stuff all over the place?

> I set the ATV's DNS to the IP of the ATV, although 127.0.0.1 will probably work as well.  
>   
> It also works if you disable the PlexConnect DNS server and edit the ATV's host file to point trailers.apple.com to the IP of your PMS.  
>   
> After further though though you should be careful with the host file route if you plan to ever move the ATV from your home network (using the PlexConnect DNS server will probably work as a portable solution when MyPlex is up and running).  
>   
> Hard drive space should not be an issue.

---

<div class="post-metadata">

**Author:** ![baa](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/baa/32/2026_2.png) [@baa](https://forums.plex.tv/u/baa)\
**Post date:** [June 22, 2013, 8:58pm UTC](https://forums.plex.tv/t/new-hack-running-the-plexconnect-python-script-on-your-jailbroken-atv2/36967/5 "2013-06-22T20:58:05Z")

</div>

stopping would be .

uninstalling "rm -rf " or something.

I guess currently the issue with the "very portable media centre" is, that you need another computer to ssh into the aTV to activate that code. This is where the daemon comes into play...

EDIT: the shutdown might not work with . you might need ...&nbsp;

---

<div class="post-metadata">

**Author:** ![alias\_rex](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/alias_rex/32/887_2.png) [@alias\_rex](https://forums.plex.tv/u/alias_rex)\
**Post date:** [June 22, 2013, 9:05pm UTC](https://forums.plex.tv/t/new-hack-running-the-plexconnect-python-script-on-your-jailbroken-atv2/36967/6 "2013-06-22T21:05:45Z")

</div>

Thanks for clarifying.&nbsp;

I see that it installs Python, so that would remain behind unless there is a uninstall python script included which I didn't see when I unpacked the .deb file. But I guess it doesn't hurt to have it installed and I can just restore the Apple TV and then jailbreak it again if something goes wrong.

> stopping would be .
> 
> uninstalling "rm -rf " or something.
> 
> I guess currently the issue with the "very portable media centre" is, that you need another computer to ssh into the aTV to activate that code. This is where the daemon comes into play...

---

<div class="post-metadata">

**Author:** ![f00b4r](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/f00b4r/32/768_2.png) [@f00b4r](https://forums.plex.tv/u/f00b4r)\
**Post date:** [June 22, 2013, 9:39pm UTC](https://forums.plex.tv/t/new-hack-running-the-plexconnect-python-script-on-your-jailbroken-atv2/36967/7 "2013-06-22T21:39:56Z")

</div>

This hack is very much for playing around at the moment, it will be much more useful when run as a daemon is part of the code.  
  
There is info on how to modify the code to do this and use launchctl in the forum but obviously we cannot support that.

---

<div class="post-metadata">

**Author:** ![alias\_rex](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/alias_rex/32/887_2.png) [@alias\_rex](https://forums.plex.tv/u/alias_rex)\
**Post date:** [June 22, 2013, 10:28pm UTC](https://forums.plex.tv/t/new-hack-running-the-plexconnect-python-script-on-your-jailbroken-atv2/36967/8 "2013-06-22T22:28:48Z")

</div>

I ran into errors during installation:

> Apple-TV:/private/var/mobile root# dpkg -i python\_2.7.3-3\_iphoneos-arm.deb  
>   
> Selecting previously deselected package python.  
>   
> (Reading database … 1745 files and directories currently installed.)  
>   
> Unpacking python (from python\_2.7.3-3\_iphoneos-arm.deb) …  
>   
> dpkg: dependency problems prevent configuration of python:  
>   
> python depends on libffi; however:  
>   
> Package libffi is not installed.  
>   
> python depends on sqlite3; however:  
>   
> Package sqlite3 is not installed.  
>   
> dpkg: error processing python (–install):  
>   
> dependency problems - leaving unconfigured  
>   
> Errors were encountered while processing:  
>   
> python

---

<div class="post-metadata">

**Author:** ![f00b4r](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/f00b4r/32/768_2.png) [@f00b4r](https://forums.plex.tv/u/f00b4r)\
**Post date:** [June 22, 2013, 11:27pm UTC](https://forums.plex.tv/t/new-hack-running-the-plexconnect-python-script-on-your-jailbroken-atv2/36967/9 "2013-06-22T23:27:35Z")

</div>

Hmm I did originally install an earlier version of python via “apt-get install python” but that caused PlexConnect to error.  
  
Roidy found that later package which I installed over the top.

---

<div class="post-metadata">

**Author:** ![bayna](https://avatars.discourse-cdn.com/v4/letter/b/bc79bd/32.png) [@bayna](https://forums.plex.tv/u/bayna)\
**Post date:** [July 22, 2013, 3:33am UTC](https://forums.plex.tv/t/new-hack-running-the-plexconnect-python-script-on-your-jailbroken-atv2/36967/10 "2013-07-22T03:33:59Z")

</div>

> I ran into errors during installation:  
> &nbsp;

apt-get install sqlite3, then try the install again.

I'm able to get in running, and I changed my hosts file by adding

trailers.apple.com &nbsp; &nbsp; &nbsp;

the trailers app still opens up normally. &nbsp;Has anyone got this working?

---

<div class="post-metadata">

**Author:** ![f00b4r](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/f00b4r/32/768_2.png) [@f00b4r](https://forums.plex.tv/u/f00b4r)\
**Post date:** [July 22, 2013, 5:15am UTC](https://forums.plex.tv/t/new-hack-running-the-plexconnect-python-script-on-your-jailbroken-atv2/36967/11 "2013-07-22T05:15:45Z")

</div>

Yes, did you flush the DNS cache on the ATV?

---

<div class="post-metadata">

**Author:** ![bayna](https://avatars.discourse-cdn.com/v4/letter/b/bc79bd/32.png) [@bayna](https://forums.plex.tv/u/bayna)\
**Post date:** [July 22, 2013, 2:54pm UTC](https://forums.plex.tv/t/new-hack-running-the-plexconnect-python-script-on-your-jailbroken-atv2/36967/12 "2013-07-22T14:54:18Z")

</div>

I can write a launchctl script when I have some time. &nbsp;If someone is feeling adventurous, you can read up on it here&nbsp;[http://n8henrie.com/2012/07/scheduling-ios-apps/.](http://n8henrie.com/2012/07/scheduling-ios-apps/.) &nbsp;

thanks for the quick reply! &nbsp;I don't know how to flush the cache. &nbsp;When I get home, I'll try restarting it and trying it again. &nbsp;Do you know of another way?

---

<div class="post-metadata">

**Author:** ![f00b4r](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/f00b4r/32/768_2.png) [@f00b4r](https://forums.plex.tv/u/f00b4r)\
**Post date:** [July 22, 2013, 3:43pm UTC](https://forums.plex.tv/t/new-hack-running-the-plexconnect-python-script-on-your-jailbroken-atv2/36967/13 "2013-07-22T15:43:36Z")

</div>

It is the same command as OSX but you may want to check the kernel version as I cannot remember if it is in sync with 10.8 or earlier.  
  
Alternatively you can pull the plug.  
  
Btw we should have a proper daemon code option in the released code soon, which will make it much easier to run on the ATV2.

---

<div class="post-metadata">

**Author:** ![bayna](https://avatars.discourse-cdn.com/v4/letter/b/bc79bd/32.png) [@bayna](https://forums.plex.tv/u/bayna)\
**Post date:** [July 22, 2013, 6:01pm UTC](https://forums.plex.tv/t/new-hack-running-the-plexconnect-python-script-on-your-jailbroken-atv2/36967/14 "2013-07-22T18:01:03Z")

</div>

plist in /System/Library/LaunchDaemons/  
the file needs to have the string property appended with .plist as per the XML property list keys  
&nbsp;

```
XML PROPERTY LIST KEYS 
The following keys can be used to describe the configuration details of your daemon or agent. Property lists are Apple's standard configuration file format. Please see plist(5) for more information. Please note: property list files are expected to have their name end in ".plist". Also please note that it is the expected convention for launchd property list files to be named .plist. Thus, if your job label is "com.apple.sshd", your plist file should be named "com.apple.sshd.plist".
```

change "var/root/PlexConnect/PlexConnect.py" to be where you installed it, in my case, in the home directory for root.

```
<?xml version="1.0" encoding="UTF-8"?>

  Label
  --RENAME THIS TO YOUR FILENAME MINUS .plist--
  ProgramArguments
  
  /usr/bin/python
  /var/root/PlexConnect/PlexConnect.py
  
  RunAtLoad
```

---

<div class="post-metadata">

**Author:** ![Dan0780](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/dan0780/32/798_2.png) [@Dan0780](https://forums.plex.tv/u/Dan0780)\
**Post date:** [November 13, 2013, 4:47am UTC](https://forums.plex.tv/t/new-hack-running-the-plexconnect-python-script-on-your-jailbroken-atv2/36967/15 "2013-11-13T04:47:47Z")

</div>

Can we bring this topic back up now that we have the daemon code and myplex incorporated. I would like to install this on a jailbroken ATV2 used at a remote location. I would like plex connect to run at startup on the Apple TV so the trailers app could be used to access my plex. I could also go down the method of installing an app using the add site method but it looks like both methods have kind of died out.  
  
  
It’s late tonight but I am gonna try too get all this working tomorrow. Is anybody currently using only their Apple TV to run plexconnect?

---

<div class="post-metadata">

**Author:** ![f00b4r](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/f00b4r/32/768_2.png) [@f00b4r](https://forums.plex.tv/u/f00b4r)\
**Post date:** [November 13, 2013, 8:01pm UTC](https://forums.plex.tv/t/new-hack-running-the-plexconnect-python-script-on-your-jailbroken-atv2/36967/16 "2013-11-13T20:01:30Z")

</div>

The auto start stuff for OSX and then likely iOS should be sorted in the next few days, including a script to run that will automatically do all the launchctl stuff for you 😉  
I will test it when done.

---

<div class="post-metadata">

**Author:** ![Dan0780](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/dan0780/32/798_2.png) [@Dan0780](https://forums.plex.tv/u/Dan0780)\
**Post date:** [November 27, 2013, 4:43am UTC](https://forums.plex.tv/t/new-hack-running-the-plexconnect-python-script-on-your-jailbroken-atv2/36967/17 "2013-11-27T04:43:01Z")

</div>

> The auto start stuff for OSX and then likely iOS should be sorted in the next few days, including a script to run that will automatically do all the launchctl stuff for you ;)  
> I will test it when done.

Awesome. &nbsp;Any luck with this? &nbsp;Are you creating a script that will create a plist file and put all the stuff in the right places? &nbsp;Just curious how you are attacking this?

---

<div class="post-metadata">

**Author:** ![f00b4r](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/f00b4r/32/768_2.png) [@f00b4r](https://forums.plex.tv/u/f00b4r)\
**Post date:** [November 27, 2013, 9:51am UTC](https://forums.plex.tv/t/new-hack-running-the-plexconnect-python-script-on-your-jailbroken-atv2/36967/18 "2013-11-27T09:51:37Z")

</div>

I had a play about with this at the weekend but ran out of time (got slowed down by SSH connectivity getting screwed up by NitoTV updates - found a fix though).  
There is a pull request on GitHub that is being tidied up at the moment, essentially:  
  
- it gets the Linux daemon code working on OSX by performing an OS detection; if it finds it to be OSX (or iOS I believe, as they share the Darwin kernel) then it waits for the network interfaces to be active before starting the daemon (this is what prevented it from working at boot previously).  
- it also come with a plist and script that yo can run which will check for certs, generate them if needed and setup PlexConnect to launch as a daemon at boot (no need for an admin password and the daemon will auto restart itself if it crashes)  
- the auto install script needed a little tweaking (see GitHub) but does work 🙂  
  
Hopefully this works on iOS without tweaking and combined with the add site hack (enabling you to disable the PlexConnect DNS server) makes a nice portable media player for this with jail broken ATV devices.  
I was getting issues getting it to auto restart on boot but I will continue to have a play with it 🙂

---

<div class="post-metadata">

**Author:** ![Dan0780](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/dan0780/32/798_2.png) [@Dan0780](https://forums.plex.tv/u/Dan0780)\
**Post date:** [November 27, 2013, 3:15pm UTC](https://forums.plex.tv/t/new-hack-running-the-plexconnect-python-script-on-your-jailbroken-atv2/36967/19 "2013-11-27T15:15:27Z")

</div>

Thanks. &nbsp;Yea after I posted last night I messed around and got it working. &nbsp;Then this morning I worked on autostart and used the same plist I am using for Mac from the gituhub commit from dlmarston. &nbsp;I just copied that over and it seems to work just fine using the daemon.bash. &nbsp;I do however have a time.sleep(10) built into plexconnect.py on my mac and now atv until the bugs are worked out with the startup network detection.

Please let me know if you guys come up with a better way but for now All I have to do is change the dns ip to the ip address that is pulled from any dhcp router and it will automatically work. &nbsp;Pretty cool. &nbsp;Next to play around with addsite.

---

<div class="post-metadata">

**Author:** ![Dan0780](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/dan0780/32/798_2.png) [@Dan0780](https://forums.plex.tv/u/Dan0780)\
**Post date:** [November 27, 2013, 4:28pm UTC](https://forums.plex.tv/t/new-hack-running-the-plexconnect-python-script-on-your-jailbroken-atv2/36967/20 "2013-11-27T16:28:28Z")

</div>

Well it seems there is a crash happening about every 60 seconds when watching a movie this way. &nbsp;I am not sure where to check logs on this.

[Next page](https://forums.plex.tv/t/new-hack-running-the-plexconnect-python-script-on-your-jailbroken-atv2/36967.md?page=2)
