Windows: bundled rg in Codex Desktop resolves on PATH but fails with Access Denied in integrated PowerShell
What happened?
In Codex Desktop on Windows, rg resolves to the bundled binary under the app package directory:
C:\Program Files\WindowsApps\OpenAI.Codex_...\app\resources\rg.exe
But invoking rg from the integrated PowerShell 7 terminal fails with Access Denied.
Reproduction steps
- Open Codex Desktop integrated terminal (PowerShell 7).
- Run:
Get-Command rg -Allrg --version
- Observe that
rgpoints to the bundled path and execution fails.
Actual result
rg --version fails with an error similar to:
Program 'rg.exe' failed to run ... Access is denied.
Also, another executable in the same folder (codex-command-runner.exe) fails with the same access-denied error when launched from terminal context.
Expected result
If bundled rg is exposed on PATH, it should be executable from the integrated terminal.
Additional diagnostics
- The bundled
rg.exefile is readable and hashable. - Copying the same binary to
%TEMP%and running it works (ripgrep 15.1.0), suggesting the issue is path/package execution policy rather than binary corruption. - ACL/SDDL for files under the package path appears to include app-identity-conditioned entries (WindowsApps package restrictions).
Workaround
Putting Git's rg.exe earlier in PATH works:
C:\Program Files\Git\usr\bin\rg.exe
After PATH update, rg --version succeeds in the same terminal.
Environment
- OS: Windows (user environment)
- Terminal: PowerShell 7.5.4 (
PSEdition=Core) - Codex Desktop package path observed:
C:\Program Files\WindowsApps\OpenAI.Codex_26.304.1528.0_x64__2p2nqsd0c76g0\app\resources
37 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
Is there any official response to this issue?
Codex Windows app is unusable right now
@azarenkova-git, just to confirm, this occurs when you attempt to invoke
rgmanually from within the app's built-in terminal? If so, why is that blocking you from using Codex Windows?@etraut-openai Codex gives me the error that rg is not usable in this shell and falls back to PowerShell file search. Meanwhile, it works just fine in the VS Code extension. The rg bundled with the app is stored in C:/Program Files/WindowsApps which it is not able to access.
Can confirm
error occurs while agent using rg.exe, just like apply_patch, they're no permission to execute
I hit the same issue and wanted to share what happened on my machine.
Environment:
rginitially resolved to the bundled binary underC:\Program Files\WindowsApps\OpenAI.Codex_...\app\resources\rg.exerg --versionfailed withAccess is deniedWhat worked for me:
winget install --id BurntSushi.ripgrep.MSVC -erg.execould be invoked directly by full path.rgat first.rgstarted resolving to the winget-installed binary instead of the bundled one.So on my side, the practical fix was:
That was enough; no permanent wrapper was needed in the end.
I had a similar issue with the same error message, I'm not sure if it had the same source though. I was able to fix it by adding the following to the custom instructions in the settings:
I can confirm that. I had the same problem (on two computers), and this solution worked right away.
I can also confirm that.
<img width="1180" height="100" alt="Image" src="https://github.com/user-attachments/assets/467204c4-c162-4850-bd0c-72e0d98e03bc" />
Setting the PATH variable didn't work for me.
But giving my user full access to the "resources" folder did the trick.
In my case, this is
I also get this very frequently, Codex falls back to PowerShell search.
You should really force it to use rg it is a much much smoother experience.
make sure its installed and in path ects.
i also added a line in the always promt use rg becouse else it wil sometimes not try that first, i think becouse somewhere its remembering that its not working or whatever.
I told codex to copy rg to apply_patch path, just working. some other PATH should work as well.
<img width="954" height="420" alt="Image" src="https://github.com/user-attachments/assets/e4c7b8e4-c03d-4dc5-a9ff-f1023065ec38" />
I get it whenever I start a session lol. What is OpenAI doing?
They're vibe coding.
On the other note, for me, administrative sandbox failed to set up and even
though I had given full access this is still happening
On Sat, 18 Apr 2026, 20:16 Sazid Al Bayazid @.***>
wrote:
Reproduced here as well on a newer Windows desktop build.
Environment:
rgtoC:\Program Files\WindowsApps\OpenAI.Codex_26.415.1938.0_x64__2p2nqsd0c76g0\app\resources\rg.exeMicrosoft Windows NT 10.0.26100.07.6.0Observed behavior inside the Codex desktop shell:
Get-Command rgsucceeds and points to the packagedrg.exerg --versionfails immediately withAccess is deniedrg.exealso fails withAccess is deniedRepresentative error:
Program 'rg.exe' failed to run: An error occurred trying to start process 'C:\Program Files\WindowsApps\OpenAI.Codex_26.415.1938.0_x64__2p2nqsd0c76g0\app\resources\rg.exe' ... Access is denied.Workaround on this machine is to avoid
rgentirely and use PowerShell-native search commands instead, but that obviously breaks the normal recommended workflow.I the same problem in both the VS Code extension and the stand-alone Codex app. Every conversation starts with this error.
Installing RipGrep separately does not work around for me:
I can run 'rg' fine from a PowerShell myself.
This is still an on going issue it seems and still exists
It very much is
This happens to me when I give the Codex desktop app "Full access," which supports the original post's assertion. It's been extremely annoying.
Hello everyone I'm pretty sure this is more of a user side config issue.
I'm guessing most of the people here have PowerShell profiles ects.
Make sure that rg is in the path of the profile that codex is using.
Codex's terminal might stop the profile init if its unable to run something on there.
Just make sure that doesnt happen and your custom install of rg is in the path.
This seems like an ACL issue. I randomly discovered today that I had a Windows 11 machine where rg worked correctly in Codex. After a lot of investigation, running this on the non-working machine:
shows that the CodexSandBoxUsers group does not have any permissions set. This directory is where a copy of rg.exe lives. On my working machine, that command showed CodexSandBoxUsers having the read/execute permissions, which explains why rg worked.
Adding CodexSandBoxUsers Read/Execute on the broken machine:
fixed the issue and allowed Codex to run rg. I have NO idea how durable that workaround is, but it worked. I couldn't even begin to explain why of the three Windows 11 machines I have with Codex on them, one of them had the ability to use rg correctly.
Further investigation shows an easier fix is to rerun the Windows sandbox setup process. I was able to trigger this by deleting ``
%USERPROFILE%\.codex\config.toml``.Upon selecting to use the elevated sandbox mode, ACEs were applied across various items in %USERPROFILE%, including rg.exe located in ``
%LOCALAPPDATA%\Packages\OpenAI.Codex_2p2nqsd0c76g0\LocalCache\Local\OpenAI``.This seems a better way at going about it as opposed to applying an explicit ACE to that location.
By elevated sandbox mode, do you mean "full access" mode? Did you just switched to it and switched back to default sandbox mode without submitting anything?
Naw I mean when you start up Codex for the first time or without a top-level config.toml on Windows it asks if you want to setup the Windows Sandbox. This sets the sandbox flag in that top-level config.toml:
and that process seems to trigger setting all the appropriate ACEs.
Ah I see, but sadly that didn't do the trick for me. Then I tried the
icacls "$env:LOCALAPPDATA\Packages\OpenAI.Codex_2p2nqsd0c76g0\LocalCache\Local\OpenAI" /grant 'CodexSandboxUsers:(OI)(CI)(RX)' /Tcommand, and it worked. Thanks!
Glad to hear! To be clear, setting that flag in the file manually didn't trigger the process. I had to force Codex to ask me to re-setup the Windows Sandbox. Codex appears to do more than just set that "elevated" flag in config.toml when setting up Windows Sandbox.
Yes I also did it like that, first deleted the config, then I opened the codex which trigged the sandbox setup prompt above the chat window. But in the end it was still unable to use rg in the sandbox.
Interesting. Good to know manually setting the ACE is still needed.
Confirming the ACL workaround fixed this for me.
Before fix:
rg --versioninside Codex failed withAccess is deniedrgresolved toC:\Program Files\WindowsApps\OpenAI.Codex_...\app\resources\rg.exewindows.sandbox: elevated(paraphrasing ofc) inconfig.tomlbut it did not fix the issue.The ACL was missing
CodexSandboxUserson$env:LOCALAPPDATA\Packages\OpenAI.Codex_2p2nqsd0c76g0\LocalCache\Local\OpenAIThis fixed it:
After restarting Codex,
rg --versionworks inside the sandbox andGet-Command rgnow resolves to:So at least on my machine, sandbox setup reported success but did not apply the needed ACE.
icacls "%AppData%\..\Local\Packages\OpenAI.Codex_2p2nqsd0c76g0\LocalCache\Local\OpenAI" /grant "CodexSandboxUsers:(OI)(CI)(RX)" /TCMD version instead of PowerShell.
OR an actual thing that actually do really yes works:
Start ELEVATED Explorer.exe
C:\Program Files\WindowsApps\OpenAI.Codex_26.422.3464.0_x64__2p2nqsd0c76g0\appright click resources-security-advanced
take ownership
close
right click resources-security-advanced
add
add your user with full control
click also thing thingy
<img width="527" height="24" alt="Image" src="https://github.com/user-attachments/assets/19f97972-d606-41cf-9802-ed13d86e9489" />
click apply ok
I hit a related but slightly different variant of this issue on the Windows Store/MSIX Codex app.
Environment:
C:\Program Files\WindowsApps\OpenAI.Codex_26.422.8496.0_x64__2p2nqsd0c76g0\...rg --versioninside Codex failed withAccess is deniedrgwas resolving to:C:\Program Files\WindowsApps\OpenAI.Codex_...\app\resources\rg.exeIn my case, the ACL workaround mentioned above was not the missing piece. This path already had
CodexSandboxUsersread/execute:showed:
The actual problem was that Codex was injecting this path into
PATH:but that directory did not exist.
The working Codex-local binaries were actually here:
That directory contained:
Fix/workaround:
After restarting Codex:
resolved first to:
and:
worked:
I also verified the
WindowsAppsand LocalCache binaries were byte-for-byte identical by SHA256, so the issue was not a bad binary. It was path/layout/packaging:were the same binary, but Windows blocked direct execution from
WindowsApps.So there may be two separate failure modes here:
CodexSandboxUsersis missing RX on%LOCALAPPDATA%\Packages\OpenAI.Codex_...\LocalCache\Local\OpenAI%LOCALAPPDATA%\OpenAI\Codex\binis injected into PATH but was never created or linked to the actual MSIX LocalCache bin directoryThe second one was the issue on my machine.
I’m seeing a related but slightly different failure mode on a fresh Codex Desktop install.
Environment
C:\Program Files\WindowsApps\OpenAI.Codex_26.429.2026.0_x64__2p2nqsd0c76g0C:\Program Files\WindowsApps\Microsoft.PowerShell_7.6.1.0_x64__8wekyb3d8bbwe\pwsh.exeIntegrated terminal behavior
In the Codex integrated terminal:
returns:
So in my integrated terminal, Codex's bundled
app\resourcesdirectory does not appear to be onPATH.Agent/tool-runner behavior
However, from the Codex agent shell/tool runner,
rgresolves to:and attempting to run it fails with:
where.exe rgfrom the tool-runner context showed:Sandbox behavior
The sandbox also appears to fail before the requested command starts. Even simple sandboxed commands such as:
failed with:
That suggests this is not only an
rg.exeissue. The sandbox process launcher itself is hitting WindowsAccess is denied.Binary validation
Copying the bundled
rg.exeout ofWindowsAppsinto the workspace made the same binary runnable outside the sandbox:So the binary itself is valid. The failure appears tied to executing it from the MSIX/WindowsApps package location and/or launching through the sandbox token.
ACL observation
The bundled
rg.exeunder the Codex package has ACL entries including app/package-identity-conditioned permissions. Owner/group areNT AUTHORITY\SYSTEM, and there are conditional entries for the Codex package identity.This seems consistent with WindowsApps/MSIX execution restrictions: the Codex app package can contain the executable, but child processes launched from the integrated terminal or restricted sandbox token may not have the package identity required to execute package resources directly.
Key difference from the original report
In the original report, the integrated terminal had Codex’s bundled
app\resourcesdirectory onPATH, soGet-Command rg -Allfoundrg.exeand then execution failed.In my fresh install, the integrated terminal does not have
rgonPATH, but the Codex agent/tool runner still does. So there appear to be at least two inconsistent states:seems like Codex is unable to access every .exe in the resources folder, not just rg:
In my case, the LocalCache ACL already grants CodexSandboxUsers read/execute, and the cached binaries run. rg failed for me because the PATH resolved to %LOCALAPPDATA%\OpenAI\Codex\bin
but that directory did not exist, so rg resolution fell through to the blocked WindowsApps resources copy. Creating that directory and copying rg.exe fixed it for me, though it's obviously hacky.
I can reproduce this on a newer Windows Codex Desktop build, and it appears to be the same WindowsApps/MSIX helper-resolution issue rather than a missing ripgrep install.
Environment:
OpenAI.Codex_26.527.3686.0_x64__2p2nqsd0c76g0ripgrepinstall in Scoop shims at the momentWhat happens:
rgresolves to:and
rg --versionfails with:Additional local diagnostics:
app\resourcespath is not in the User PATH or Machine PATH. It appears only in the Codex-launched process PATH.codex.exe,node.exe,rg.exe, etc.) have theEncryptedattribute.codex.exedirectly from the sameapp\resourcesdirectory also fails with Access Denied.%LOCALAPPDATA%\OpenAI\Codex\binexists, but it currently contains only a.staging-*directory and norg.exe,node.exe,codex.exe, etc.%LOCALAPPDATA%\Packages\OpenAI.Codex_2p2nqsd0c76g0\LocalCache\Local\OpenAI\Codex\bindoes not exist on this machine.So this local state looks like the per-user helper bin did not finish materializing/syncing, and the agent/tool PATH then falls through to the protected WindowsApps package resources copy. That copy is discoverable and hashable, but not executable from the spawned shell/tool context.
Practical workaround remains installing a separate ripgrep earlier on PATH, e.g. with Scoop, then restarting Codex Desktop so the refreshed PATH resolves
rgbefore the blocked WindowsApps copy. But the product-side issue seems to be that Codex exposes a non-executable packaged helper path, or fails to populate/use the intended per-user helper bin first.