Apple TV Binaries

From AwkwardTV
Jump to: navigation, search

If you plan on using the command line on the Apple TV via SSH, there are a number of important binaries that are missing that you will want to install. I have compiled some binaries from source on an Intel Mac, which work on Apple TV.

Download precompiled Binaries

Binary Source Manpage Version Size
gunzip binary source manpage 1.2.4 58K
gzip binary source manpage 1.2.4 58K
nano binary source manpage 2.0.6 128K
unzip binary source manpage 5.5.2 126K
wget binary source manpage 1.10.2 217K
zip binary source manpage 2.32 74K
top binary source manpage  ? 390K

Note: There are no manpages installed on Apple TV, but you can find them online, e.g. from Apple: http://developer.apple.com/DOCUMENTATION/Darwin/Reference/ManPages/index.html

Compile your own Binaries

If you don't trust other people or you need different binaries, you can also compile binaries by yourself. If you have a Mac this is quite simple - as long it's not very complex software which needs additional libraries...

An example how I created the gzip and gunzip binaries:

Requirements

Download the Source

Go to http://www.gzip.org/#sources and download the latest version of the gzip source code (e.g. gzip-1.2.4.tar.gz).

Extract the Files from Archive

How this works depends on the file type. In case it's .tar.gz:

tar -xzf gzip-1.2.4.tar.gz

./configure

Now you have to run the configure script. Since you don't want to install the created files on your Mac, i'd recommend using the --prefix switch, to install the files somewhere else:

cd gzip-1.2.4
./configure --prefix=$HOME/apple_tv_files

make

Now start compiling:

make

make install

Now install the binaries to the directory specified by --prefix:

make install

After that, the binary should be in $HOME/apple_tv_files/bin. In this case, you will find gzip as well as gunzip (and some other binaries from the gzip package).

Test if it works

E.g. try to display the --help output:

$HOME/apple_tv_files/bin/gzip --help

If it works, copy the file to your Apple TV and try if it works there too. If you have more complex applications which need some libraries, this will not work that easy (usually you have to compile the libraries before and pass the path to an according ./configure switch, see ./configure --help and less INSTALL), but for the simple tools mentioned above it worked fine.

Note: For zip and unzip this worked a little bit different:

unzip zip232.zip
cd zip232\ Folder
make -f unix/Makefile generic
./zip --help #that's the created file

Install Binaries on Apple TV

The easiest way is probably simply copying the binaries to /usr/bin or /sbin on Apple TV. But if you want to have your binaries seperated from binaries shipped with Apple TV, you can do it this way:

Create bin Directory in $HOME

Create a bin directory in a hidden directory (.atv) in $HOME:

mkdir -p /Users/frontrow/.atv/bin

Add Directory to $PATH

If the binaries should be executed without using the complete path, you have to add your directory to $PATH.

echo "export PATH=$PATH:/Users/frontrow/.atv/bin" >> /Users/frontrow/.bash_profile 

Note: To make this work you have to log in again.

Copy files to your bin directory

To copy the gzip file from a Mac/PC:

scp gzip frontrow@[IP-Address]:/Users/frontrow/.atv/bin

After that you can use gzip from the commandline on Apple TV.


PS: if you wonder about the sf.net page, I'll write something about that in the forum soon.

Fixing Permission denied message

After you copy the binary file, when you first try to use it you might get an "/Users/frontrow/.atv/bin/BINARY: Permission denied" error. This can be fixed by using the chmod comand. Just type:

chmod 555 BINARYFILE. 

As an example:

chmod 555 /Users/frontrow/.atv/bin/unzip