0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

ターミナルからのVScode起動時に警告が出る問題

Posted at

code .すると起動するが下記のような警告が出た

$ code .
[0509/182154.821020:ERROR:codesign_util.cc(109)] SecCodeCheckValidity: Error Domain=NSOSStatusErrorDomain Code=-67062 "(null)" (-67062)```

意味のなかった対応

VSCodeの設定を含む全て削除し、再度公式サイトからインストール
→何も変わらなかt

解決方法

下記コマンドを実行し、ウィザードに従ってパスワードを入れたりすればOK

codesign --force --deep --sign - /Applications/Visual\ Studio\ Code.app

コマンドの中身

オプション 説明
--force すでにある署名を強制的に上書き
--deep アプリ内部(バンドル内)のすべてのバイナリにも署名(ネストされた実行ファイル含む)
--sign - 自己署名(ad-hoc署名)する。Apple ID や認証済みの開発者証明書を使わず、署名だけして Gatekeeper を通すようにする
/Applications/Visual\ Studio\ Code.app 対象アプリケーション

なぜ治るのか?

macOS はアプリの実行時に「コード署名」がApple 開発者署名 or 信頼できる署名であることを Gatekeeper が検証しています。

何らかの理由で VS Code の署名が壊れていた、あるいは一部のバイナリ(例えば code コマンドや拡張)が署名から外れていた場合、SecCodeCheckValidity エラーで実行がブロックされます。

codesign --deep --sign - は、
「署名は適当(ad-hoc)でもいいから、署名の一貫性だけ保って再構築してくれ」
という命令で、Gatekeeper を黙らせます。

ただし、この方法は「とりあえず使えるようにする」ための応急処置的な手段です。

参考

こちらを参考にさせていただきました。
ありがとうございます🙏
http://nalab.mind.meiji.ac.jp/~mk/knowhow-2024/node17.html

0
0
0

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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?