Hacker News new | past | comments | ask | show | jobs | submit login
Libimobiledevice – Open-source library to communicate with iOS devices natively (libimobiledevice.org)
283 points by pabs3 on July 7, 2021 | hide | past | favorite | 80 comments



At https://testingbot.com we use this to install apps, take screenshots and manage devices for our users running tests against our physical iOS devices.


does testingbot support running tests with Detox[0]?

[0] https://github.com/wix/Detox


not yet - though we would like to add support for Detox in the future.


While trying to get parts of this to compile, I found https://github.com/tihmstar/usbmuxd2 which you can replace usbmuxd with and get wifi sync support.


Has anyone a solution to use this to backup the iPhone to a linux pc (raspi) automaticaly?


libimobiledevice has a command-line tool to initiate a backup, you should be able to run it on the RPi.


For restoring a backup to a Linux filesystem, libimobiledevice requires the iOS device to be present, so you will probably want ideviceunback instead, which doesn't have this issue:

https://github.com/libimobiledevice/libimobiledevice/issues/... https://github.com/inflex/ideviceunback


Does anyone even have a solution for automated scheduled script execution on the iPhone?


There doesn’t have to run anything special on the IPhone. In the early days iTunes could make backups on the local pc when the iPhone was connected via usb. Later on apple extended this to wifi: so if you had an iTunes running in your wifi and the iPhone joined a backup was done at the iTunes side.

I‘m not sure if this feature is still there, but I would have found this very useful if it would have been possible with the computer that is running anyways (as in the pi).


have a look at the 'shortcuts' app[1]. the automation thing has conditional triggers inluding time of day and actions like ssh-rpc.

[1] https://apps.apple.com/us/app/shortcuts/id915249334


Those are extremeley limited and I don't think it's possible to run any kind of interesting scripts locally.

I did look at it when I still had an iPhone and it's one of those "almost usable but fundamentally broken" things that are par for iOS. It works well enough that I could spend a weekend or two making stuff that almost works with it.


Jailbroken devices have this ability. At one point I had rclone daemon syncing iCloud files to Seafile through the terminal. You can also run scripts through Shortcuts by local ssh


> I don't think it's possible to run any kind of interesting scripts locally.

it has the ability to run pythonista scripts amog others... but yea, it's not a fully exposed unix where most things are files.


Most things are, in fact, files. It's just a massive pain to do anything with them.


Jailbroken you used to be able to use LaunchDaemons to handle this. Not sure if this is still the case.


can someone explain the usecase for this? what kind of apps you'll opens up when you can communicate to apple devices natively? you can't do that before this?


Flutter uses the tools built on top of this to automate the installation and bootstrap into their interactive code reload mechanism (by watching the device's syslog for the application to output the right port to connect to, which is then also accessed over the USB muxing bridge: libimobiledevice provides a way to activate the port mappings) for iOS apps you develop.

Essentially, this is giving you the ability to write tools similar to Android's adb (Android Debug Bridge), a tool that connects over USB to a daemon running on the phone to let you run commands and install apps and access the logs (which I take advantage of in Cydia Impactor, generalizing over the functionality of an integrated adb client and the functionality from libimobiledevice).


I use it to mount iPhone as a FUSE filesystem in order to download photos using rsync.


It seems like the answer is "no", but … iPhones don't expose themselves as MTP devices when connected to USB?

I'm an Android user, but that just seems like basic table stakes…?


There are some very surprising tradeoffs for being in Apple’s ecosystem. Especially if you’re used to Android.

Let’s just say this: Apple took the time to create a whole different interface for the TRRS headphone jack just so they could have buttons on the headphone cable. Then when app developers thought it was awesome to be able to use that button as a trigger while the app was in the foreground, Apple stopped them by removing their App store listing until the dev submitted a version without that feature. Same with detecting touch size (to ingeniously determine touch pressure).


Is this also possible with music? Got any links on details about that setup?


Maybe also look into unison ( https://github.com/bcpierce00/unison ) instead of rsync so you get 2-way sync :)


From the (currently broken) FAQ [1]: "Sorry, music synchronization with newer devices is currently not supported but if you are a keen developer why not contribute a new service implementation for the ATC Service?"

[1] https://libimobiledevice.org/#faq


I recently found one of the tools (some kind of low level REPL console) helpful to get my phone out of a recovery mode boot loop. I couldn't figure out how to do it any other way and was pretty grateful for its existence.

I had been feeling brave and tried to do a reset + update via KVM'd iTunes, but something went wrong with USB hot plugging with the way the device switches modes between boots ^_^.


can you please share more details about the tool and what did you do? I feel I am in the same boat, and a bit lost :)



I use it for tethering with my iPhone since my phone internet is better and more stable than the cable internet I have otherwise. I wouldn't be aware that this is possible without Libimobiledevice.


If your wireless carrier enables it, you can create a wifi hotspot under Settings > Personal Hotspot.


I believe he is talking about tethering via USB, which should be a more stable connection than Wifi.


Ah but the Settings app does USB hotspots too


You need this library in order for the connection to work. Then it will show up as a LAN connection.


It may support that, but the tethered hotspot mentioned previously works perfectly well without this library for me on my Mac. When tethered together and hotspot enabled, I can use the iPhone's cellular data with no wifi on the Mac at all.


This library is really targeted toward non Apple systems.


With Linux?


Yes with this library and a companion kernel module it will appear like a standard network interface (connected to the phone acting as a NAT router).


Could I use this to (for example) read and/or write the iPhone databases for Reminders and Calendar ? I ask because ifuse source is not compiling on macOS.


We were using this for test automation to install, launch and terminate apps on 50+ devices.


For example, doing backups and restores without requiring iTunes or OS X.


So this is not for building ios applications


This is a communication and control library for iOS-based devices. For example, with this library you could program an application on Solaris which would control iOS devices or be able to transfer data to and from them, or do pedestrian things like load your own certificates into the target iOS device's store...


Does loading certificates allow you to MITM apps? E.g. to discover/reverse engineer an API?

I suppose certificate pinning could pose problems.


You can do this without this library. On iOS you could install an app like Charles Proxy, and install their cert to intercept traffic. Or you could proxy all traffic through your computer. Most apps does use certificate pinning today, but many still don't. I recently used this technique to reverse engineer a video streaming app


Debugging Safari mobile if you don't have a macOS devices. I used to do this when I was using Ubuntu for web development.


It's up to the app. I can use it to copy CBZ/CBR/PDF files into my comics reader or access my saved drawings from ArtStudio Pro: https://i.imgur.com/v5bckxU.png


Yup I’m confused here too

Like is it an alternative to iTunes especially for people who are using Linux


If you do lots of test automation (especially on multiple platforms), its utility is immediately apparent.


I use it for tethering when Comcast goes down. You also need ipheth-utils.


Everything you'd do with adb.


Past related threads:

Libimobiledevice 1.3.0 Released - https://news.ycombinator.com/item?id=23540185 - June 2020 (1 comment)

libimobiledevice – A cross-platform library to communicate with iOS devices - https://news.ycombinator.com/item?id=9670745 - June 2015 (15 comments)

libimobiledevice - Teaching Penguins to Talk to Fruit - https://news.ycombinator.com/item?id=4596648 - Oct 2012 (13 comments)


None of the collapsible elements (tabs, accordions, etc) on this website work in Chrome for me. Looks like their "waypoints" javascript wants jQuery, and it's not being loaded.


Could you gather some info from the devtools and report this as a bug to the website repo?

https://github.com/libimobiledevice/libimobiledevice.org/iss...



FWIW it does not work on (mobile) Firefox for me either.


Could this be useful for adding iOS support to Syncthing?


If you want to run Syncthing on iOS, take a look at Möbius Sync.


>The Möbius Sync iOS app is not open source at this time.


Very interesting! Can I assume this would work with the Windows Subsystem for Linux? The Windows directions aren't filled in there.


You can find windows builds in this fork https://github.com/libimobiledevice-win32/imobiledevice-net, but make sure you have iTunes 12.x version installed.


I haven’t tested, but I believe it won’t work, at least by USB – WSL doesn’t have USB pass-through.


Could it be possible to have the usbmuxd part on the windows side, most likely the iTunes's Apple Mobile Device Helper service, and connect to it through TCP from WSL which might a bit of configuration on libimobiledevice or use socat to redirect from domain socket to TCP port.


Wasted 3h when this didn't work with my iPhone 12 pro, but did work with my wifes 11 pro. Was so confused...


It seems like Apple actively tries to ruin the functionality of libimobiledevice with each release of iOS. It worked the best on my iPhone 6 and iOS 9.3.4.


It seems even stranger to me to consider it an active effort.

More likely to me that engineering teams at Apple simply don't give much of a shit about maintaining compatibility with a tool that's not affiliated with them, and will redesign things or make breaking changes as it suits their project goals - and unaffiliated tools like this are simply stuck in a perpetual game of catchup.


> and unaffiliated tools like this are simply stuck in a perpetual game of catchup.

So it's still a problem. Apple knows about these unaffiliated tools, and they do very little to maintain communique with them until it's convenient for Apple to do so. This is nothing new, and it's one of the reasons you couldn't pay me to develop on iOS these days.


But why should they maintain communications with them? Don't get me wrong, it would certainly be nice of them to, but I don't see how someone else doing unaffiliated, unrequested, unguaranteed work based on my own work creates any sort of obligation for either of us.


I figure that it would be a good way for the world's most valuable company to give back to their core userbase, and it would certainly be a step in the right direction for helping developers like me who are highly skeptical of Apple's commitment to building a robust developer ecosystem. They need all the help they can get, because it's starting to look less and less viable for me to switch to a Mac as time goes on. It will be interesting to watch how they reconcile pressure from developers over the next few years.


When do people realize that an iPhone is not a general purpose computer and was never intended to be one?


I think iphone owners on here understand what apple intends for their devices, but simply like the alternatives less. So they try and hack around the restrictions placed on their iphones.


Because the iPhone is capable of being a general purpose computer, and the only one stopping it from being one so far is Apple.


General purpose computers, as we understand them, are a niche market and potentially quite harmful in untrained hands. Apple is targeting the mainstream consumer. They still sell GPCs though, under the Mac brand.


Even more harmful: smaller and smaller numbers of people who actually understand how computers work.


Apple is welcome to build the "mainstream computer", but they should do so with respect to the protocols and open-source space around them. If they continue their oppressive approach to hardware and software development, they'll have a hard time defending themselves when people accuse them of a monopoly.


When Apple marketing stops saying otherwise.


Computer appliance, a computing device with a specific function and limited configuration ability.


Have you considered that your idea of a general purpose computer might just be different than pretty much everyone else?


Strange, it's working fine for me on iOS 15 beta, but I'm using an older iPhone XS. I would expect the OS version to matter more than the hardware.


Worked with my 12 Pro a few weeks ago - did you try the latest version from Git?


Some distros package outdated versions. The git version seems to work fine.


The page is broken. If you look in the HTML source, it is trying to include the homepage URL as a script on line 1506:

<script src="https://libimobiledevice.org/"></script>

Edit: Formatting


Could you file an issue or pull request about this on the website repo?

https://github.com/libimobiledevice/libimobiledevice.org/iss...




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: