Skip to content

Instantly share code, notes, and snippets.

@kfatehi
Last active September 24, 2021 16:51
Show Gist options
  • Star 13 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save kfatehi/8922430 to your computer and use it in GitHub Desktop.
Save kfatehi/8922430 to your computer and use it in GitHub Desktop.
Compiling libimobiledevice on Raspberry Pi

iPhone Tethering on Raspberry Pi

The instructions here are useful although the current packages in Arch and Debian repositories do not work with iOS 7 (Trust Loop Bug) but it is still a good starting point to understand how this works.

https://wiki.archlinux.org/index.php/IPhone_Tethering

iOS 7 Support

Install libimobiledevice from latest source

In order to get iOS 7 support, we need to compile everything from master -- See the attached script for your distribution.

Usage

Mounting your iPhone

Start usbmuxd: usbmuxd

Create a mount point: mkdir /media/iphone

Mount the device: ifuse /media/iphone

(You can unmount using umount /media/iphone)

You should now be able to view the contents of your iPhone.

Networking

At this point you should reboot so that modules and rules get loaded. After that, I gave up on ArchLinux due to issues getting actual network traffic to go across, so I can't speak for ArchLinux from herein. However I did have success on Raspbian. You should be able to simply plug in your iPhone and see a new interface come up and be able to ping the outside world. Enjoy!

pacman -Syu vim tmux git base-devel libxml2 python2 fuse
mkdir iphone_libs && cd iphone_libs
git clone https://github.com/libimobiledevice/libplist.git
git clone https://github.com/libimobiledevice/libusbmuxd.git
git clone https://github.com/libimobiledevice/usbmuxd.git
git clone https://github.com/libimobiledevice/libimobiledevice.git
git clone https://github.com/libimobiledevice/ifuse.git
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
echo "export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig" | sudo tee -a /etc/bash.bashrc
cd libplist && ./autogen.sh && make && make install && cd ..
cd libusbmuxd && ./autogen.sh && make && make install && cd ..
cd libimobiledevice && ./autogen.sh && make && make install && cd ..
cd usbmuxd && ./autogen.sh && make && make install && cd ..
cd ifuse && ./autogen.sh && make && make install && cd ..
groupadd -g 140 usbmux &>/dev/null
useradd -c 'usbmux user' -u 140 -g usbmux -d / -s /sbin/nologin usbmux &>/dev/null
passwd -l usbmux &>/dev/null
echo /usr/local/lib | sudo tee /etc/ld.so.conf.d/libimobiledevice-libs.conf
sudo ldconfig
sudo apt-get update
sudo apt-get -y upgrade
sudo apt-get -y install vim tmux git build-essential libxml2-dev python2.7 python2.7-dev fuse libtool autoconf libusb-1.0-0-dev libfuse-dev
mkdir iphone_libs && cd iphone_libs
git clone https://github.com/libimobiledevice/libplist.git
git clone https://github.com/libimobiledevice/libusbmuxd.git
git clone https://github.com/libimobiledevice/usbmuxd.git
git clone https://github.com/libimobiledevice/libimobiledevice.git
git clone https://github.com/libimobiledevice/ifuse.git
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
echo "export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig" | sudo tee -a /etc/bash.bashrc
cd libplist && ./autogen.sh && make && sudo make install && cd ..
cd libusbmuxd && ./autogen.sh && make && sudo make install && cd ..
cd libimobiledevice && ./autogen.sh && make && sudo make install && cd ..
cd usbmuxd && ./autogen.sh && make && sudo make install && cd ..
cd ifuse && ./autogen.sh && make && sudo make install && cd ..
groupadd -g 140 usbmux &>/dev/null
useradd -c 'usbmux user' -u 140 -g usbmux -d / -s /sbin/nologin usbmux &>/dev/null
passwd -l usbmux &>/dev/null
echo /usr/local/lib | sudo tee /etc/ld.so.conf.d/libimobiledevice-libs.conf
sudo ldconfig
@alzeih
Copy link

alzeih commented Mar 12, 2014

Alternatively, install usbmuxd-git libimobiledevice-git and ifuse-git from the AUR.

@saurabhnigam
Copy link

While installing on raspbian My make ran for 2 days until I realized configure is running in infinite loop. I found a similar problem here @ http://www.linuxquestions.org/questions/linux-newbie-8/warning-modification-time-1-3e-08-s-in-the-future-640287/ that stated this was because of Raspbian's incorrect time. After setting the time ' date -s "08/06/2008 15:30" ' as root things worked as charm.

@br3nt
Copy link

br3nt commented May 20, 2014

When I connected the iPhone via usb after running raspbian-install.sh and rebooting, I no longer experienced the Trust Loop Bug, however, when running sudo ifuse /media/iphone I got an error advising that it could not find a connected device.

I found the answer in iphone_libs/ifuse/README. I ran the following commands and then rebooted:

sudo modprobe fuse
sudo adduser pi fuse

After a reboot I was able to successful use ifuse to mount the iphone and use hotspot.

@br3nt
Copy link

br3nt commented May 20, 2014

Also, following the Putting it all Together section of Dave Conroy's blog post, tethering works seamlessly!

@piglovesyou
Copy link

Thank you @keyvanfatehi, you saved me. It works.
For the record, AUR couldn't install them all.

$ yaourt -S usbmuxd-git libimobiledevice-git ifuse-git
...
==> ERROR: libplist-git is not available for the 'armv7h' architecture.

@styro2000
Copy link

hello,
while compiling on 2015-05-05-raspbian-wheezy it gives me a
/usr/bin/ld: usbmuxd-utils.o: undefined reference to symbol 'clock_gettime@@GLIBC_2.4'
error...

to fix the compilation error change:
/home/pi/iphone_libs/usbmuxd/autogen.sh line 18
if [ -z "$NOCONFIGURE" ]; then
./configure "$@"
fi

to

if [ -z "$NOCONFIGURE" ]; then
LDFLAGS=-lrt ./configure "$@"
fi

not nice but it seems to work... :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment