{"id":757,"date":"2026-02-12T11:18:42","date_gmt":"2026-02-12T11:18:42","guid":{"rendered":"https:\/\/aiopsschool.com\/blog\/?p=757"},"modified":"2026-02-12T11:18:43","modified_gmt":"2026-02-12T11:18:43","slug":"codex-how-to-install-codex-in-windows","status":"publish","type":"post","link":"https:\/\/aiopsschool.com\/blog\/codex-how-to-install-codex-in-windows\/","title":{"rendered":"Codex: How to install Codex in Windows?"},"content":{"rendered":"\n<p><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Codex CLI on Windows (native install)<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Prereqs<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Windows 10\/11 + PowerShell<\/li>\n\n\n\n<li>Node.js + npm installed<\/li>\n\n\n\n<li>Note: Codex on Windows runs with an <strong>experimental sandbox<\/strong> in agent mode to restrict writes outside the working folder and block network access unless approved. (<a href=\"https:\/\/developers.openai.com\/codex\/windows?utm_source=chatgpt.com\">OpenAI Developers<\/a>)<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Install<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>npm i -g @openai\/codex\n<\/code><\/pre>\n\n\n\n<p>Codex CLI is OpenAI\u2019s local coding agent. (<a href=\"https:\/\/developers.openai.com\/codex\/cli?utm_source=chatgpt.com\">OpenAI Developers<\/a>)<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Find where npm installed the <code>codex<\/code> command<\/h3>\n\n\n\n<p><code>npm bin -g<\/code> may not exist on newer npm versions, so use <code>prefix<\/code> instead. (<a href=\"https:\/\/docs.npmjs.com\/cli\/v9\/commands\/npm-prefix\/?v=true&amp;utm_source=chatgpt.com\">npm Docs<\/a>)<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$prefix = (npm prefix -g).Trim()\n$prefix\ndir \"$prefix\\codex*\"\n<\/code><\/pre>\n\n\n\n<p>You should see <code>codex.cmd<\/code> (and often <code>codex.ps1<\/code>) in that folder.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Run it (PowerShell gotcha)<\/h3>\n\n\n\n<p>If you run a quoted path with arguments, use PowerShell\u2019s <strong>call operator<\/strong> <code>&amp;<\/code>. (<a href=\"https:\/\/ss64.com\/ps\/call.html?utm_source=chatgpt.com\">SS64<\/a>)<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&amp; \"$prefix\\codex.cmd\" --version\n&amp; \"$prefix\\codex.cmd\"\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Fix \u201ccodex is not recognized\u201d (PATH)<\/h3>\n\n\n\n<p><strong>For the current PowerShell window only:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$env:Path += \";$prefix\"\ncodex --version\n<\/code><\/pre>\n\n\n\n<p><strong>Permanent fix (User PATH) + restart terminal:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$userPath = &#91;Environment]::GetEnvironmentVariable(\"Path\",\"User\")\nif ($userPath -notlike \"*$prefix*\") {\n  &#91;Environment]::SetEnvironmentVariable(\"Path\", ($userPath.TrimEnd(';') + \";\" + $prefix), \"User\")\n}\n<\/code><\/pre>\n\n\n\n<p>Then <strong>close PowerShell and open a new one<\/strong>, and run:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>codex --version\ncodex\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Login (if browser auth is blocked)<\/h3>\n\n\n\n<p>Use device-code login:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>codex login --device-auth\n<\/code><\/pre>\n\n\n\n<p>(<a href=\"https:\/\/developers.openai.com\/codex\/auth?utm_source=chatgpt.com\">OpenAI Developers<\/a>)<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Quick troubleshoot<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>where.exe codex\nnpm list -g --depth=0\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Alternative (often smoother)<\/h3>\n\n\n\n<p>OpenAI also provides a <strong>WSL2<\/strong> path if you\u2019d rather run Codex in a Linux environment on Windows. (<a href=\"https:\/\/developers.openai.com\/codex\/windows?utm_source=chatgpt.com\">OpenAI Developers<\/a>)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Codex CLI on Windows (native install) Prereqs Install Codex CLI is OpenAI\u2019s local coding agent. (OpenAI Developers) Find where npm [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-757","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/aiopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/757","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/aiopsschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/aiopsschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/aiopsschool.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/aiopsschool.com\/blog\/wp-json\/wp\/v2\/comments?post=757"}],"version-history":[{"count":1,"href":"https:\/\/aiopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/757\/revisions"}],"predecessor-version":[{"id":758,"href":"https:\/\/aiopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/757\/revisions\/758"}],"wp:attachment":[{"href":"https:\/\/aiopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=757"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/aiopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=757"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/aiopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=757"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}