LoginSignup
9
3

More than 3 years have passed since last update.

Big SurかつXVim2導入済みXcodeでApple IDログインできない件

Last updated at Posted at 2021-02-17

Intro

Xcodeを使うvimmers必需品のXVim2ですが、titleの課題が発生しています。

How

解決方法はないかと、XVim2リポジトリのissuesを眺めていると、関連しそうなissueが見つかりました。

On macOS Big Sur, after codesign Xcode and try to login to my account, got "Couldn’t communicate with a helper application" #340

上記issueを読んでいただければ分かる通り、絶賛議論中で、いまのところの解決策は、

Posting here to try to confirm if others are experiencing the same problem on macOS Big Sur. If so, I guess there's no way to use XVim2 normally as it requires codesign? My thinking is keeping 2 copies of Xcode, one untouched to build to devices or upload to App Store, and another one codesigned to use XVim2.

ということで、XVim2用XcodeとApple IDログインするためのXcode、2つのXcode(s)を用意する、という方法しかなさそうです。。。。。:cry:

Why

そもそもなぜこのような課題が発生しているのでしょう。
さきほどのissueを眺めていると、どうもXVim2導入時に行われるXcodeへのresignに起因しているようです。
https://github.com/XVimProject/XVim2/issues/340#issuecomment-739686765

ではそもそもなぜ、XVim2を導入するためにXcodeのresignが必要なのでしょうか。

XVim2がちょうどよいTL;DRを提供してくれているので、そのまま引用します。

TL;DR
When you download Xcode from Apple (either from the Mac AppStore or the downloads page) it is signed. From Xcode 8 onwards, you need to replace this signature to load many plugins (like XVim2).

This is because in 2016 Apple announced a new replacement for plugins called Source Editor Extensions, which would be the only permitted approach for loading third-party tools into Xcode (such as XVim2). This meant that many existing plugins would no longer work after Xcode 8. Apple probably decided to do this for a number of reasons with the main one being to patch security vulnerabilities highlighted by the XcodeGhost malware, which used the old plugin system as part of its attack vector.

Apple's decision meant that any existing plugins would have to be rewritten to support the new Source Editor Extensions system, however, in many instances this is not yet possible because the extension system does not yet provide enough access via APIs for plugins to replicate their existing feature sets. Many features are simply not yet achievable in the new extension system 😔 but hopefully they will be one day.

Replacing the existing Xcode signature currently bypasses the restriction for versions of Xcode newer than Xcode 8 and allows them to still load old plugins like XVim2. If you don't replace the signature, Xcode will quietly refuse to load the plugin and it will not work.

さらに要約(意訳かもしれないです)すると、
Xcode8から、Xcodeの3rd party developersはXcodeKitを用いて拡張機能を書かなくてはならない、というupdateがあった。
が、XcodeKitはXVim2の要件を満たすために必要な機能を提供してくれていない。
ので、Xcode8以降でも古い仕組みで書かれたプラグインであるXVim2がworkするように、Xcodeをresignして無理やり延命させている。
とのことです。

ということで、resignされてしまっているXcodeでApple IDログインできない、という課題は、仕様通りの可能性が高いため、今後のXcodeのupdateでXVim2が今まで通りにworkするようになる可能性は低そうです。。

正攻法は、XcodeKitを用いてVim機能をXcodeで実現する、かもですが、XVim2作者の方が、下記のように述べているので厳しそうです :cry:

Apple's decision meant that any existing plugins would have to be rewritten to support the new Source Editor Extensions system, however, in many instances this is not yet possible because the extension system does not yet provide enough access via APIs for plugins to replicate their existing feature sets.

ただ、上記は2018年のドキュメントなので、現在であればワンチャンある、んでしょうか。。。このままの状況が続くのであれば、ちょっとtryしてみたいですね。。。。。。。

Outro

物理escキーを一度は廃止したりと、Apple Inc.さんはvimmersを軽視し過ぎではないでしょうか。。
Android StudioのベースになっているIntelliJ IDEAなんかだと、本家JetBrainsさんがVim機能を実現するプラグインを提供してくれています。
https://github.com/JetBrains/ideavim

ということで、Xcodeが最初からXVim2のような機能を提供してくれるのもありなのでは、と考えます。

  1. Xcodeで快適なvim体験ができる
  2. vimmerなiOS/macOS developers(主観でしかないですがかなり多いはず)のモチベーションや生産性up
  3. モチベーションや生産性upしたvimmersによる良質なiOS/macOSアプリが増えてApp Storeエコシステムがより強固なものに
  4. Apple Inc.さん うれしい

Apple Inc.さんにも多大なメリットがあるのでは、と思いましたので、どうかよろしくお願いいたします :pray: :apple:

2021-03-14追記

下記に落ち着きました。

  • programを書く
  • それ以外(もちろんApple IDログイン含む)
    • Xcode(XVim2なし)

AppCodeを使うのであれば、XVim2の課題がなかったとしても自然と上記構成となるため、複数のXcode(s)を使い分けないといけない、というような理不尽さを払拭できる。

XVim2、いままでありがとうございました :pray: :pray: :pray:

2021-06-08追記

:pray: :apple:

Vim mode
Many common key combinations and editing modes familiar to Vim users are supported directly within the code editor, using the new bottom bar to show mode indicators.

9
3
6

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
3