Flutter安装之install --HEAD libimobiledevice

前言

在安全Flutter SDK完成后,我们通常需要执行flutter doctor来检查是否需要安装其他依赖项,如果有依赖项未完成通常会有以下提示:

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel beta, v0.5.1, on Mac OS X 10.14.6 18G103, locale zh-Hans-CN)
[✓] Android toolchain - develop for Android devices (Android SDK 28.0.3)
[!] iOS toolchain - develop for iOS devices (Xcode 11.1)
    ✗ libimobiledevice and ideviceinstaller are not installed. To install, run:
        brew install --HEAD libimobiledevice
        brew install ideviceinstaller
    ✗ ios-deploy not installed. To install:
        brew install ios-deploy
    ! CocoaPods out of date (1.5.0 is recommended).
        CocoaPods is used to retrieve the iOS platform side's plugin code that responds to your plugin usage on the Dart side.
        Without resolving iOS dependencies with CocoaPods, plugins will not work on iOS.
        For more info, see https://flutter.io/platform-plugins
      To upgrade:
        brew upgrade cocoapods
        pod setup
[✓] Android Studio (version 3.5)
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
[!] IntelliJ IDEA Ultimate Edition (version 2018.2.3)
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
[!] VS Code (version 1.34.0)
[✓] Connected devices (1 available)

! Doctor found issues in 3 categories.

其中开头有 [ ✗ ] 标识的项代表尚未安装的依赖项,在创建Flutter项目之前需要先安装这些依赖项,我们使用提示中的命令安装对应的依赖项。

安装 libimobiledevice and ideviceinstaller

安装方法:在终端中输入brew install --HEAD libimobiledevice,如果顺利的话这一步将会被顺利安装完成。但是现实往往充满意外,以下是我整理的安装过程中发现的错误以及解决方案:

1) 网络异常时长会出现安装错误 [ Checksum mismatch ] 和 [ Failed to install vendor Ruby ]:

$ brew install --HEAD libimobiledevice
Updating Homebrew...
==> Downloading https://homebrew.bintray.com/bottles-portable-ruby/portable-ruby--2.6.3.mavericks.bottle.tar.gz

curl: (28) Operation timed out after 300491 milliseconds with 0 out of 0 bytes received
==> Downloading https://github.com/Homebrew/homebrew-portable-ruby/releases/download/2.6.3/portable-ruby--2.6.3.mavericks.bottle.tar.gz
###########                                                               15.9%
curl: (56) LibreSSL SSL_read: SSL_ERROR_SYSCALL, errno 54
Error: Checksum mismatch.
Expected: ab81211a2052ccaa6d050741c433b728d0641523d8742eef23a5b450811e5104
  Actual: 1d049e3de7b925fb6ca493beb5a65968f499d437325765e4cedd5f578ff9ab7c
 Archive: /Users/anyone/Library/Caches/Homebrew/portable-ruby--2.6.3.mavericks.bottle.tar.gz
To retry an incomplete download, remove the file above.
Error: Failed to install vendor Ruby.

发生以上问题后,再次执行brew install --HEAD libimobiledevice会得到一样的错误,因为第一次下载失败了,导致下载的文件并不完成,文件的SHA1和服务器上的不匹配,如果继续安装需要删掉已下载的旧文件,在终端中执行以下命令:

rm -rf /Users/anyone/Library/Caches/Homebrew/portable-ruby--2.6.3.mavericks.bottle.tar.gz

再次执行 libimobiledevice and ideviceinstaller的安装命令:brew install --HEAD libimobiledevice

2) 发生错误 [ Xcode alone is not sufficient on Mojave. ]:

$ brew install --HEAD libimobiledevice
==> Downloading https://homebrew.bintray.com/bottles-portable-ruby/portable-ruby--2.6.3.mavericks.bottle.tar.gz
######################################################################## 100.0%
==> Pouring portable-ruby--2.6.3.mavericks.bottle.tar.gz
Updating Homebrew...
Error: Xcode alone is not sufficient on Mojave.
Install the Command Line Tools:
  xcode-select --install

按照提示在终端中输入命令:xcode-select --install,在弹出的窗口 [ 如下图 ] 中点击 安装 按钮 :

安装提示

在接下来弹出的协议页面 [ 如下图 ] 点击 同意 按钮:

软件许可协议

接下来会弹出下载进度窗口 [ 见下图 ],不用做任何操作,等待完成即可 :
软件下载中...

等待软件下载完成后,点图窗口 [ 见下图 ] 中的 完成按钮即可完成安装。
软件安装完成

接下来再回到终端窗口执行命令 : brew install --HEAD libimobiledevice

3) 发生错误 [ configure: error: Package requirements (libusbmuxd >= 1.1.0) were not met ]:

Last 15 lines from /Users/anyone/Library/Logs/Homebrew/libimobiledevice/01.autogen.sh:
checking dynamic linker characteristics... darwin18.7.0 dyld
checking how to hardcode library paths into programs... immediate
checking for pkg-config... /usr/local/opt/pkg-config/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for libusbmuxd >= 1.1.0... no
configure: error: Package requirements (libusbmuxd >= 1.1.0) were not met:

Requested 'libusbmuxd >= 1.1.0' but version of libusbmuxd is 1.0.10

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables libusbmuxd_CFLAGS
and libusbmuxd_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

READ THIS: https://docs.brew.sh/Troubleshooting

错误原因:系统要求的libusbmuxd 版本和所要安装的版本不一致的问题导致的。
解决方法:按照顺序执行下面的命令

#如果执行后提示错误 Error: No such keg: /usr/local/Cellar/libimobiledevice说明libimobiledevice还没有安装成功,直接执行下一条命令即可
brew uninstall --ignore-dependencies libimobiledevice
brew uninstall --ignore-dependencies usbmuxd
brew install --HEAD usbmuxd
brew unlink usbmuxd
brew link usbmuxd
brew install --HEAD libimobiledevice

如果在执行命令brew uninstall --ignore-dependencies libimobiledevice 的时候提示错误 [Error: No such keg: /usr/local/Cellar/libimobiledevice] 说明libimobiledevice还没有安装成功,直接执行下一条命令即可。

执行完以上命令后,libimobiledevice 就能顺利安装完成。

参考:

  1. 有一个美丽的小女孩的博客 安装libimobiledevice出现问题:onfigure: error: Package requirements (libusbmuxd >= 1.1.0) were not met
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 216,544评论 6 501
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 92,430评论 3 392
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 162,764评论 0 353
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 58,193评论 1 292
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 67,216评论 6 388
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 51,182评论 1 299
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 40,063评论 3 418
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 38,917评论 0 274
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 45,329评论 1 310
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 37,543评论 2 332
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 39,722评论 1 348
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 35,425评论 5 343
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 41,019评论 3 326
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 31,671评论 0 22
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 32,825评论 1 269
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 47,729评论 2 368
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 44,614评论 2 353