brew install --HEAD libimobiledevice が通らんかったのでなんとかした

#Flutterをしよう
諸事情あってFlutterを触る必要が出てきたので、まずは環境構築。
`flutter doctor`までは公式サイトの[Get Started](https://flutter.dev/docs/get-started/install/macos)を参照していただきたい。
んで、PATHを通してこれっぽいのが出てくればOK。

```zsh 
% flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.2.1, on Mac OS X 10.14.3 18D109, locale ja-JP)
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[!] iOS toolchain - develop for iOS devices (Xcode 10.1)
    ✗ libimobiledevice and ideviceinstaller are not installed. To install with
      Brew, run:
        brew update
        brew install --HEAD usbmuxd
        brew link usbmuxd
        brew install --HEAD libimobiledevice
        brew install ideviceinstaller
[!] Android Studio (version 3.3)
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
[!] VS Code (version 1.31.1)
    ✗ Flutter extension not installed; install from
      https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[!] Connected device
    ! No devices available

! Doctor found issues in 4 categories.
```
中間のあたりで`libimobiledevice`なるパッケージを突っ込めと言われるので指示に従う。
#どうしてこうなった 

```zsh 
% brew install --HEAD libimobiledevice
==> Cloning https://git.libimobiledevice.org/libimobiledevice.git
Cloning into '/Users/reno.89m/Library/Caches/Homebrew/libimobiledevice--git'...
error: RPC failed; curl 18 transfer closed with outstanding read data remaining
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
Error: An exception occurred within a child process:
  DownloadError: Failed to download resource "libimobiledevice"
Failure while executing; `git clone --branch master https://git.libimobiledevice.org/libimobiledevice.git /Users/reno.89m/Library/Caches/Homebrew/libimobiledevice--git` exited with 128. Here's the output:
Cloning into '/Users/reno.89m/Library/Caches/Homebrew/libimobiledevice--git'...
error: RPC failed; curl 18 transfer closed with outstanding read data remaining
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
```
？？？？？？？？
<img width="1440" alt="スクリーンショット 2019-03-09 1.53.53.png" src="https://qiita-image-store.s3.amazonaws.com/0/320738/d4427fdd-b086-d0d1-4ea1-ddb21e4dd5e0.png">
(;´Д`)
#解決方法
githubのリポジトリがあったので、Cloneしてセルフビルドする。

```zsh 
% git clone https://github.com/libimobiledevice/libimobiledevice.git
Cloning into 'libimobiledevice'...
remote: Enumerating objects: 27, done.
remote: Counting objects: 100% (27/27), done.
remote: Compressing objects: 100% (16/16), done.
remote: Total 8261 (delta 14), reused 18 (delta 11), pack-reused 8234
Receiving objects: 100% (8261/8261), 2.56 MiB | 2.01 MiB/s, done.
Resolving deltas: 100% (5794/5794), done.
```
そしたらREADME.md通りにシェルスクリプトを叩く

```zsh
% cd libimobiledevice
% ./autogen.sh
~~~~~~省略
checking for openssl >= 0.9.8... no
checking for gnutls >= 2.2.0... no
configure: error: Package requirements (gnutls >= 2.2.0) were not met:

No package 'gnutls' found

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

Alternatively, you may set the environment variables libgnutls_CFLAGS
and libgnutls_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
```
**なんで💢**
と思ったけどこれに関してはすでに解決方法がネットに出てた(https://cloud.tencent.com/developer/article/1394906)


#解決方法その②
さっきのリンクの通りにgnutlsとlibgcryptを突っ込んだ後、`--disable-openssl`オプションを追加してスクリプトを叩く。

```zsh
% brew install gnutls
% brew install libgcrypt

% ./autogen.sh --disable-openssl
% make
% make install
```
インストールできたのでもう一度`flutter doctor`を確認してみる。(`libimobiledevice`以外は導入に成功している場合)

```zsh 
% flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.2.1, on Mac OS X 10.14.3 18D109, locale ja-JP)
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[✓] iOS toolchain - develop for iOS devices (Xcode 10.1)
[!] Android Studio (version 3.3)
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
[!] VS Code (version 1.31.1)
    ✗ Flutter extension not installed; install from
      https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[!] Connected device
    ! No devices available

! Doctor found issues in 3 categories.
```
iOStoolchain解決🎉
あとは普通にAndroid StudioとVSCodeの設定を済ませればOK
みんなもLet's Flutter😉
![たのしいよ](https://qiita-image-store.s3.amazonaws.com/0/320738/a9c526ee-cfa0-5046-1949-df9181998c7a.png)