用这个开源工具在 Linux 上访问你的 iPhone
iOS iPhone

> 
> 通过使用 Libimobiledevice 从 Linux 与 iOS 设备进行通信。
> 
> 
> 


![](/data/attachment/album/202108/31/092907bc26qep3ekc73czl.jpg "A person looking at a phone")


iPhone 和 iPad 绝不是开源的，但它们是流行的设备。许多拥有 iOS 备的人恰好也在使用大量的开源软件，包括 Linux。Windows 和 macOS 的用户可以通过使用苹果公司提供的软件与 iOS 设备通信，但苹果公司不支持 Linux 用户。开源程序员早在 2007 年（就在 iPhone 发布一年后）就以 Libimobiledevice（当时叫 libiphone）来拯救了人们，这是一个与 iOS 通信的跨平台解决方案。它可以在 Linux、Android、Arm 系统（如树莓派）、Windows、甚至 macOS 上运行。


Libimobiledevice 是用 C 语言编写的，使用原生协议与 iOS 设备上运行的服务进行通信。它不需要苹果公司的任何库，所以它完全是自由而开源的。


Libimobiledevice 是一个面向对象的 API，它捆绑了许多便于你使用的终端工具。该库支持苹果从最早到其最新的型号的 iOS 设备。这是多年来研究和开发的结果。该项目中的应用包括 `usbmuxd`、`ideviceinstaller`、`idevicerestore`、`ifuse`、`libusbmuxd`、`libplist`、`libirecovery` 和 `libideviceactivation`。


### 在 Linux 上安装 Libimobiledevice


在 Linux 上，你可能已经默认安装了 `libimobiledevice`。你可以通过你的软件包管理器或应用商店找到，或者通过运行项目中包含的一个命令：



```
$ ifuse --help

```

你可以用你的包管理器安装 `libimobiledevice`。例如，在 Fedora 或 CentOS 上：



```
$ sudo dnf install libimobiledevice ifuse usbmuxd

```

在 Debian 和 Ubuntu 上：



```
$ sudo apt install usbmuxd libimobiledevice6 libimobiledevice-utils

```

或者，你可以从源代码 [下载](https://github.com/libimobiledevice/libimobiledevice/) 并安装 `libimobiledevice`。


### 连接你的设备


当你安装了所需的软件包，将你的 iOS 设备连接到你的电脑。


为你的 iOS 设备建立一个目录作为挂载点。



```
$ mkdir ~/iPhone

```

接下来，挂载设备：



```
$ ifuse ~/iPhone

```

你的设备提示你，是否信任你用来访问它的电脑。


![iphone prompts to trust the computer](/data/attachment/album/202108/31/092918i3601p6z9r3i90gs.png)


*图 1：iPhone 提示你要信任该电脑。*


信任问题解决后，你会在桌面上看到新的图标。


![iphone icons appear on desktop](/data/attachment/album/202108/31/092919cx6dxclxu93cx19s.png)


*图 2：iPhone 的新图标出现在桌面上。*


点击 “iPhone” 图标，显示出你的 iPhone 的文件夹结构。


![iphone folder structure displayed](/data/attachment/album/202108/31/092919ric11gnzcsc0yisc.png)


*图 3：显示了 iPhone 的文件夹结构。*


我通常最常访问的文件夹是 `DCIM`，那里存放着我的 iPhone 照片。有时我在写文章时使用这些照片，有时有一些照片我想用 GIMP 等开源应用来增强。可以直接访问这些图片，而不是通过电子邮件把它们发给我自己，这是使用 `libimobiledevice` 工具的好处之一。我可以把这些文件夹中的任何一个复制到我的 Linux 电脑上。我也可以在 iPhone 上创建文件夹并删除它们。


### 发现更多


[Martin Szulecki](https://github.com/FunkyM) 是该项目的首席开发者。该项目正在寻找开发者加入他们的 [社区](https://libimobiledevice.org/#community)。Libimobiledevice 可以改变你使用外设的方式，而无论你在什么平台上。这是开源的又一次胜利，这意味着它是所有人的胜利。




---


via: <https://opensource.com/article/21/8/libimobiledevice-iphone-linux>


作者：[Don Watkins](https://opensource.com/users/don-watkins) 选题：[lujun9972](https://github.com/lujun9972) 译者：[geekpi](https://github.com/geekpi) 校对：[wxy](https://github.com/wxy)


本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译，[Linux中国](https://linux.cn/) 荣誉推出


OK
The iPhone and iPad aren't by any means open source, but they're popular devices. Many people who own an iOS device also happen to use a lot of open source, including Linux. Users of Windows and macOS can communicate with an iOS device by using software provided by Apple, but Apple doesn't support Linux users. Open source programmers came to the rescue back in 2007 (just a year after the iPhone's release) with Libimobiledevice (then called libiphone), a cross-platform solution for communicating with iOS. It runs on Linux, Android, Arm systems such as the Raspberry Pi, Windows, and even macOS.


Libimobiledevice is written in C and uses native protocols to communicate with services running on iOS devices. It doesn't require any libraries from Apple, so it's fully free and open source.

Libimobiledevice is an object-oriented API, and there are a number of terminal utilities that come bundled with it for your convenience. The library supports Apple's earliest iOS devices all the way up to its latest models. This is the result of years of research and development. Applications in the project include **usbmuxd**, **ideviceinstaller**, **idevicerestore**, **ifuse**, **libusbmuxd**, **libplist**, **libirecovery**, and **libideviceactivation**.

## Install Libimobiledevice on Linux

On Linux, you may already have **libimobiledevice** installed by default. You can find out through your package manager or app store, or by running one of the commands included in the project:

`$ ifuse --help`


You can install **libimobiledevice** using your package manager. For instance, on Fedora or CentOS:

`$ sudo dnf install libimobiledevice ifuse usbmuxd`


On Debian and Ubuntu:

`$ sudo apt install usbmuxd libimobiledevice6 libimobiledevice-utils`


Alternatively, you can [download](https://github.com/libimobiledevice/libimobiledevice/) and install **libimobiledevice** from source code.

## Connecting your device

Once you have the required packages installed, connect your iOS device to your computer.

Make a directory as a mount point for your iOS device.

`$ mkdir ~/iPhone`


Next, mount the device:

`$ ifuse ~/iPhone`


Your device prompts you to trust the computer you're using to access it.

![iphone prompts to trust the computer](https://opensource.com/sites/default/files/1trust_0.png)

Figure 1: The iPhone prompts you to trust the computer.

Once the trust issue is resolved, you see new icons on your desktop.

![iphone icons appear on desktop](https://opensource.com/sites/default/files/2docks.png)

Figure 2: New icons for the iphone appear on the desktop.

Click on the **iPhone** icon to reveal the folder structure of your iPhone.

![iphone folder structure displayed](https://opensource.com/sites/default/files/2iphoneicon.png)

Figure 3: The iPhone folder structure is displayed.

The folder I usually access most frequently is **DCIM**, where my iPhone photos are stored. Sometimes I use these photos in articles I write, and sometimes there are photos I want to enhance with open source applications like Gimp. Having direct access to the images instead of emailing them to myself is one of the benefits of using the Libimobiledevice utilities. I can copy any of these folders to my Linux computer. I can create folders on the iPhone and delete them too.

## Find out more

[Martin Szulecki](https://github.com/FunkyM) is the lead developer for the project. The project is looking for developers to add to their [community](https://libimobiledevice.org/#community). Libimobiledevice can change the way you use your peripherals, regardless of what platform you're on. It's another win for open source, which means it's a win for everyone.

## 5 Comments