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?

普段の開発でpi-sandboxのsandbox.jsonに必要だった項目

0
Last updated at Posted at 2026-06-24

そのままだと困ることがあったので備忘。

Git

git pushできない

自分は~/.gitconfigとSSHの認証鍵が読めないという理由でgit pushが動かなかった。

おま環ではあるが、素直に~/.gitconfigallowReadに追加しても動かず、その原因は自分がその手のdotfilesを~/devs/dotfiles以下で管理して、シンボリックリンクを貼っていたため。つまり、パーミッションエラーが出ているファイルパスだけを許可してもダメで、さらにリンク元のファイルかディレクトリも合わせて許可しないといけない。

{
  "filesystem": {
    "allowRead": [
      // ...
      "~/devs/dotfiles",
      "~/.gitignore_global",
      "~/.gitconfig",
      "~/.ssh",
    ]
  }
}

~/.gitignore_globalはなくてもgit自体は使えるが git status とかやる時に毎回パーミッションエラーメッセージがでてうざいので入れておいた方が良さそう。

あとallowedDomains*.github.comも必要だった気がするが、忘れた。

.git/config が読めない

バックエンドで使われているanthropic-experimental/sandbox-runtime.git以下の書き込みを丸ごとブロックしており、これはallowWriteで許可することができない。

正しくは allowGitConfig を使うこと。

{
  "filesystem": {
    "allowGitConfig": true
  }
}

Github CLI

そのままだと401で認証が通らない。

Github CLIはMacOSだとKeychainsに認証情報を格納しているらしく、それを許可する必要がある。

{
  "filesystem": {
    "allowRead": [
      // ...
      "~/Library/Keychains"
    ]
  }
}

tmux

piが出してくるWarning: tmux extended-keys is off. Modified Enter keys may not work. Add set -g extended-keys on to ~/.tmux.conf and restart tmux.という警告のままに.tmux.confに書き加えても動かない。

解決策としてはtmuxが接続に使っているUnix Domainソケットのファイルを許可する必要がある。

{
  "network": {
    // ...
    "allowUnixSockets": [
      "/private/tmp/tmux-[uid]"
    ]
  }
}

[uid]の箇所はid -uで取れる値を使う

また、自分の場合はAlacrittyを使っており、それがShift+Enterを送信しないという問題もあった。

npm

npm view some-packageが動かなかった。

原因はnpm view.npm配下にキャッシュとして情報を配置するからで、解決にはallowWriteへの追加が必要だった。

{
  "filesystem": {
    "allowWrite": [
      // ...
      "~/.npm"
    ]
  }
}

pnpm

グローバルキャッシュにアクセスできないと pnpm install がコケる

{
  "filesystem": {
    "allowRead": [
      "~/Library/pnpm"
    ]
  }
}

nslookup

動かなかったが、AIに調べさせた結果以下を追加したら動いた。

{
  "network": {
    // ...
    "allowLocalBinding": true,
    "allowMachLookup": [
      "com.apple.SystemConfiguration.configd",
      "com.apple.dnssd.service",
      "com.apple.trustd.agent"
    ],
    "allowUnixSockets": [
      "/var/run/mDNSResponder"
    ]
  }
}

Github Copilot

以下のようにsandboxで設定しないと copilot -p "hello" みたいなやつが特にレスポンスなくexit 1する。

{
  "filesystem": {
    "allowRead": [
      "~/.copilot"
    ],
    "allowWrite": [
      "~/.copilot"
    ],
  },
  "network": {
    "allowedDomains": [
      "api.business.githubcopilot.com",
      "*.githubcopilot.com"
    ]
  }
}
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?