macOS挂载iOS应用沙盒文件夹

发布于:2025-07-04 ⋅ 阅读:(21) ⋅ 点赞:(0)

背景

工具

  • libimobiledevice: linux,macOS等与ios设备通信是的工具

  • macFUSE 是 macOS 文件系统扩展的“引擎”,支持开发者创建各类虚拟文件系统。

  • iFUSE 是专为 iOS 设备设计的“连接器”,需依赖 macFUSE 实现功能。

若需访问 iPhone/iPad 文件,必须同时安装两者;若仅需挂载网络存储或开发自定义文件系统,则只需 macFUSE。

安装

brew install libimobiledevice

brew install --cask macfuse

sudo ln -s /Library/Filesystems/macfuse.fs/Contents/Resources/mount_macfuse /usr/local/bin/
sudo ln -s /Library/Filesystems/macfuse.fs/Contents/Resources/load_macfuse /usr/local/bin/
sudo ln -s /Library/Filesystems/macfuse.fs/Contents/Resources/macfuse_stat /usr/local/bin/

brew install ifuse 
# 或者
# 1. 添加第三方仓库
brew tap gromgit/fuse

# 2. 直接安装适配版 ifuse
brew install gromgit/fuse/ifuse-mac  # 注意使用 `-mac` 后缀

# 3. 验证版本
ifuse --version  # 通常为最新稳定版(如 1.1.4+)

安装过程遇到依赖没有就安装相应的依赖,网络原因下载不了?
配置~/.bash_profile, source

brew install gromgit/fuse/ifuse-mac
lockf: 200: already locked
Error: Another `brew update` process is already running.
Please wait for it to finish or terminate it to continue.
==> Downloading https://ghcr.io/v2/gromgit/fuse/ifuse-mac/manifests/1.1.4-1
######################################################################################################################################################################################################################################################## 100.0%
==> Downloading https://formulae.brew.sh/api/formula.jws.json

Warning: formula.jws.json: update failed, falling back to cached version.
==> Downloading https://formulae.brew.sh/api/formula.jws.json
Warning: formula.jws.json: update failed, falling back to cached version.
==> Downloading https://formulae.brew.sh/api/formula.jws.json
Warning: formula.jws.json: update failed, falling back to cached version.
==> Downloading https://formulae.brew.sh/api/formula.jws.json
Warning: formula.jws.json: update failed, falling back to cached version.
Error: Cannot download non-corrupt https://formulae.brew.sh/api/formula.jws.json!
export BASH_SILENCE_DEPRECATION_WARNING=1
export PATH=$PATH:/opt/homebrew/bin:/Users/jenkinsuser/workspace/env

export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.ustc.edu.cn/brew.git"
export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.ustc.edu.cn/homebrew-core.git"
export HOMEBREW_BOTTLE_DOMAIN="https://mirrors.ustc.edu.cn/homebrew-bottles"
# brew4.x API加速
export HOMEBREW_API_DOMAIN="https://mirrors.ustc.edu.cn/homebrew-bottles/api"
# hide
export HOMEBREW_NO_ENV_HINTS="1"

#
export HOMEBREW_NO_INSTALL_FROM_API=1

版本不匹配?推荐版本搭配

组件 推荐版本 安装来源
macFUSE 4.10.2 brew install --cask macfuse
ifuse ≥1.1.4 gromgit/fuse Tap(首选)或修改公式安装

macfuse 内核拓展安装不上?

  1. 重启进入revover模式,安全选项,中开启允许安装第三方的内核拓展程序。
  2. 重启,执行load_macfuse 加载内核拓展,在设置,安全与隐私中找到
    macfuse内核拓展安装的安装事件。允许,即可。

使用

前置条件

  1. 设备要求:
  • iOS 设备已通过 USB 连接到 Mac
  • 设备已信任当前电脑(解锁设备后出现的提示中选择"信任")
  • 设备已开启文件共享(仅能访问已启用文件共享的应用)
  1. 应用要求:
  • 应用必须明确启用文件共享(在 Info.plist 中添加 UIFileSharingEnabled=true)
  • 开发者应用需要有效的签名描述文件

查找bundle id

  1. 使用ideviceinstaller
# 安装工具
brew install ideviceinstaller
# 列出所有应用
ideviceinstaller -l

或者iosdeploy,cfgutil等

挂载应用的路径

  1. 挂载命令
# 基本命令格式
ifuse <挂载点目录> \
  --bundle-id <应用的Bundle ID> \
  [--documents | --container]
选项 作用
–documents 挂载应用的 Documents 目录
–container 挂载整个应用沙盒容器(需要开发者签名)
–root 挂载整个设备文件系统(仅限越狱设备)
# 创建挂载点
mkdir ~/myapp_documents

# 挂载应用的 Documents 目录
ifuse ~/myapp_documents --bundle-id com.mycompany.MyApp --documents

# 挂载整个沙盒容器(需要开发者证书)
mkdir ~/myapp_container
ifuse ~/myapp_container --bundle-id com.mycompany.MyApp --container

访问

应用沙盒文件夹tree如下:

├── Documents/        # 用户文档(通过 --documents 挂载)
├── Library/
│   ├── Preferences/  # 应用偏好设置 (.plist)
│   └── Caches/       # 缓存文件
├── tmp/              # 临时文件
└── .com.apple.mobile_container_manager.metadata.plist  # 容器元数据

卸载路径

# 卸载指定挂载点
umount ~/myapp_documents

# 强制卸载(如果普通卸载失败)
fusermount -u ~/myapp_documents

网站公告

今日签到

点亮在社区的每一天
去签到