homebrew-cask の GPG Suite 一覧


ほどなくして古くなりそうなので、記事の鮮度が分かりやすい Qiita に。

## GPG Suite

https://gpgtools.org/

> # GPG Suite
> One simple package
> with everything you need,
> to protect your emails and files.

GitHub に GnuPG で署名しようとすると、最近は pinentry-mac を直接入れるより[こちらを入れるように書かれている](https://docs.github.com/ja/authentication/managing-commit-signature-verification/signing-commits)。

ただ 2022/02 現在で homebrew-cask にこのパッケージは4つある

- [gpg-suite](https://formulae.brew.sh/cask/gpg-suite)
- gpg-suite-nightly (現在消滅？)
- [gpg-suite-no-mail](https://formulae.brew.sh/cask/gpg-suite-no-mail)
- [gpg-suite-pinentry](https://formulae.brew.sh/cask/gpg-suite-pinentry)

この違いをCaskfileから見てみる

### [gpg-suite](https://github.com/Homebrew/homebrew-cask/blob/HEAD/Casks/gpg-suite.rb)

```ruby
  pkg "Install.pkg"
```
パッケージインストール時にオプション選択肢の指定がない。
なので、GPG Mailなどが一通り入る。

### [gpg-suite-no-mail](https://github.com/Homebrew/homebrew-cask/blob/HEAD/Casks/gpg-suite-no-mail.rb)

```ruby
  pkg "Install.pkg",
      choices: [
        {
          "choiceIdentifier" => "installer_choice_1", # preinstall.pkg
          "choiceAttribute"  => "selected",
          "attributeSetting" => 1,
        },
        {
          "choiceIdentifier" => "installer_choice_2", # Libmacgpg_Core.pkg
          "choiceAttribute"  => "selected",
          "attributeSetting" => 1,
        },
        {
          "choiceIdentifier" => "installer_choice_3", # LibmacgpgXPC_Core.pkg
          "choiceAttribute"  => "selected",
          "attributeSetting" => 1,
        },
        {
          "choiceIdentifier" => "installer_choice_4", # GPGMail_6_Core.pkg
          "choiceAttribute"  => "selected",
          "attributeSetting" => 0,
        },
        {
          "choiceIdentifier" => "installer_choice_5", # GPGMail_5_Core.pkg
          "choiceAttribute"  => "selected",
          "attributeSetting" => 0,
        },
        {
          "choiceIdentifier" => "installer_choice_6", # GPGMail_4_Core.pkg
          "choiceAttribute"  => "selected",
          "attributeSetting" => 0,
        },
        {
          "choiceIdentifier" => "installer_choice_7", # GGPGMail_3_Core.pkg
          "choiceAttribute"  => "selected",
          "attributeSetting" => 0,
        },
        {
          "choiceIdentifier" => "installer_choice_8", # GPGMail_12_Core.pkg
          "choiceAttribute"  => "selected",
          "attributeSetting" => 0,
        },
        {
          "choiceIdentifier" => "installer_choice_9", # GPGMailLoader_Core.pkg
          "choiceAttribute"  => "selected",
          "attributeSetting" => 0,
        },
        {
          "choiceIdentifier" => "installer_choice_10", # GPGServices_Core.pkg
          "choiceAttribute"  => "selected",
          "attributeSetting" => 1,
        },
        {
          "choiceIdentifier" => "installer_choice_11", # GPGKeychain_Core.pkg
          "choiceAttribute"  => "selected",
          "attributeSetting" => 1,
        },
        {
          "choiceIdentifier" => "installer_choice_12", # GPGPreferences_Core.pkg
          "choiceAttribute"  => "selected",
          "attributeSetting" => 1,
        },
        {
          "choiceIdentifier" => "installer_choice_13", # MacGPG2.1_Core.pkg
          "choiceAttribute"  => "selected",
          "attributeSetting" => 1,
        },
        {
          "choiceIdentifier" => "installer_choice_14", # Updater_Core.pkg
          "choiceAttribute"  => "selected",
          "attributeSetting" => 1,
        },
        {
          "choiceIdentifier" => "installer_choice_15", # pinentry_Core.pkg
          "choiceAttribute"  => "selected",
          "attributeSetting" => 1,
        },
        {
          "choiceIdentifier" => "installer_choice_16", # version.pkg
          "choiceAttribute"  => "selected",
          "attributeSetting" => 1,
        },
        {
          "choiceIdentifier" => "installer_choice_17", # key.pkg
          "choiceAttribute"  => "selected",
          "attributeSetting" => 1,
        },
        {
          "choiceIdentifier" => "installer_choice_18", # CheckPrivateKey.pkg
          "choiceAttribute"  => "selected",
          "attributeSetting" => 1,
        },
      ]

```
パッケージインストール時に GPG Mail 関係のオプション選択肢が `0` に指定されていて、それ以外は `1` になっている。
なので、以下は入る。

 - `libmacgpg`
 - [MacGPG2](https://github.com/GPGTools/MacGPG2)
 - [GPGServices](https://github.com/GPGTools/GPGServices)
 - [GPGKeychain](https://github.com/GPGTools/GPGKeychainAccess)
 - [GPGPreferences](https://github.com/GPGTools/GPGPreferences)
 - `pinentry`

よって `/usr/local/MacGPG2/bin/gpg2` が入るので別途 `gnupg` を導入する必要はない。
 
### [gpg-suite-pinentry](https://github.com/Homebrew/homebrew-cask/blob/HEAD/Casks/gpg-suite-pinentry.rb)

```ruby
  pkg "Install.pkg",
      choices: [
        {
          "choiceIdentifier" => "installer_choice_1", # preinstall.pkg
          "choiceAttribute"  => "selected",
          "attributeSetting" => 0,
        },
        {
          "choiceIdentifier" => "installer_choice_2", # Libmacgpg_Core.pkg
          "choiceAttribute"  => "selected",
          "attributeSetting" => 0,
        },
        {
          "choiceIdentifier" => "installer_choice_3", # LibmacgpgXPC_Core.pkg
          "choiceAttribute"  => "selected",
          "attributeSetting" => 0,
        },
        {
          "choiceIdentifier" => "installer_choice_4", # GPGMail_6_Core.pkg
          "choiceAttribute"  => "selected",
          "attributeSetting" => 0,
        },
        {
          "choiceIdentifier" => "installer_choice_5", # GPGMail_5_Core.pkg
          "choiceAttribute"  => "selected",
          "attributeSetting" => 0,
        },
        {
          "choiceIdentifier" => "installer_choice_6", # GPGMail_4_Core.pkg
          "choiceAttribute"  => "selected",
          "attributeSetting" => 0,
        },
        {
          "choiceIdentifier" => "installer_choice_7", # GGPGMail_3_Core.pkg
          "choiceAttribute"  => "selected",
          "attributeSetting" => 0,
        },
        {
          "choiceIdentifier" => "installer_choice_8", # GPGMail_12_Core.pkg
          "choiceAttribute"  => "selected",
          "attributeSetting" => 0,
        },
        {
          "choiceIdentifier" => "installer_choice_9", # GPGMailLoader_Core.pkg
          "choiceAttribute"  => "selected",
          "attributeSetting" => 0,
        },
        {
          "choiceIdentifier" => "installer_choice_10", # GPGServices_Core.pkg
          "choiceAttribute"  => "selected",
          "attributeSetting" => 0,
        },
        {
          "choiceIdentifier" => "installer_choice_11", # GPGKeychain_Core.pkg
          "choiceAttribute"  => "selected",
          "attributeSetting" => 0,
        },
        {
          "choiceIdentifier" => "installer_choice_12", # GPGPreferences_Core.pkg
          "choiceAttribute"  => "selected",
          "attributeSetting" => 0,
        },
        {
          "choiceIdentifier" => "installer_choice_13", # MacGPG2.1_Core.pkg
          "choiceAttribute"  => "selected",
          "attributeSetting" => 0,
        },
        {
          "choiceIdentifier" => "installer_choice_14", # Updater_Core.pkg
          "choiceAttribute"  => "selected",
          "attributeSetting" => 0,
        },
        {
          "choiceIdentifier" => "installer_choice_15", # pinentry_Core.pkg
          "choiceAttribute"  => "selected",
          "attributeSetting" => 1,
        },
        {
          "choiceIdentifier" => "installer_choice_16", # version.pkg
          "choiceAttribute"  => "selected",
          "attributeSetting" => 0,
        },
        {
          "choiceIdentifier" => "installer_choice_17", # key.pkg
          "choiceAttribute"  => "selected",
          "attributeSetting" => 0,
        },
        {
          "choiceIdentifier" => "installer_choice_18", # CheckPrivateKey.pkg
          "choiceAttribute"  => "selected",
          "attributeSetting" => 0,
        },
      ]

```

`pinentry` しか選択されていない。
なので Keychain や System Preference に統合はされない（はず）。

`pinentry` しか使わない、OS統合部分に興味はないし他にGPG署名使わない、というなら `gpg-suite-pinentry` で問題ない。

もちろん、この場合 MacGPG2 が入っていないので別途 `gnupg` なりを導入する必要がある。
既に `gnupg` を導入している場合、 MacGPG2 が持つ `/usr/local/MacGPG2/bin/gpg2` が存在しないので複数バージョンの `gpg2` が存在する状況を回避できる。

## 結局どれ？

- GPG Mail を使うなら `gpg-suite`
- Mailには使わないけどMacらしく使うなら `gpg-suite-no-mail`
- 別途 `gnupg` などを使うコマンドラインオンリー派は `gpg-suite-pinentry`

あたりだろうか。