Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

This article is a Private article. Only a writer and users who know the URL can access it.
Please change open range to public in publish setting if you want to share this article with other users.

【Windows】CodexアプリをMXC無効化の管理設定で復旧する手順(復旧機能付き)

0
Posted at

この記事の手順は、筆者の環境で試したものです。
実行するときは、必ずバックアップを取ってから自己責任でお願いします。

概要

Windows版Codexアプリを、管理設定ファイル(requirements.toml)でMXCを無効化して復旧する手順です。
設定前に config.toml のバックアップも自動で取ります。
なお、これはMXCの不具合を回避する一時的な設定で、保護機能を完全に無効化するものではないです。
将来MXC側が修正されたら、設定を元に戻して再検証できる

手順

① Codexアプリを完全終了する

作業内容を保存してから、Codexアプリを終了します。

② PowerShellを「管理者として実行」する

スタートボタンを右クリックし、「ターミナル(管理者)」を選びます。

③ コマンドを実行する(バックアップ+復旧設定)

以下のコマンドを貼り付けて実行します。

& {
    $ErrorActionPreference = "Stop"

    $configPath = Join-Path $env:USERPROFILE ".codex\config.toml"
    $backupPath = "$configPath.backup-$(Get-Date -Format 'yyyyMMdd-HHmmss')"
    Copy-Item -LiteralPath $configPath -Destination $backupPath -ErrorAction Stop
    Write-Output "バックアップ:$backupPath"

    $policyDir = Join-Path $env:ProgramData "OpenAI\Codex"
    $policyPath = Join-Path $policyDir "requirements.toml"

    if (Test-Path -LiteralPath $policyPath) {
        Write-Output "既存の管理設定があります。上書きしていません。"
        return
    }

    New-Item -ItemType Directory -Path $policyDir -Force | Out-Null

    $policyText = @'
[windows]
allow_mxc = false
allowed_sandbox_implementations = ["elevated"]
'@

    New-Item -ItemType File -Path $policyPath -Value $policyText -ErrorAction Stop | Out-Null

    Write-Output "MXC無効化設定を作成しました"
    Get-Content -LiteralPath $policyPath
}

このコマンドは次のことを行います。

  • %USERPROFILE%\.codex\config.toml を日時付きのファイル名でバックアップ
  • %ProgramData%\OpenAI\Codex\requirements.toml に、MXCを無効化する管理設定を作成
  • すでに requirements.toml がある場合は上書きせずに終了

作成される設定の内容は以下です。

[windows]
allow_mxc = false
allowed_sandbox_implementations = ["elevated"]

④ Codexを再起動して確認する

Codexアプリを再起動し、動作を確認します。


免責事項
この記事の内容を利用したことで生じたいかなる損害についても、筆者は責任を負いかねます。あらかじめご了承ください。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?