Can't read/edit files
What version of Codex is running?
0.30.0
Which model were you using?
gpt5-medium
What platform is your computer?
Darwin 24.6.0 arm64 arm
What steps can reproduce the bug?
I'd like to use codex for my project. But I get strange issues that codex can't read/edit files.
While running I see plenty of errors like that:
` Explored
└ List ls -la
Search rg --files
Search find . -maxdepth 3 -type d -print
• Ran cat -n README.md | sed -n '1,120p'
└ bash: cat: command not found
bash: sed: command not found
`
Tried installing codex from npm and brew. No changes. When I'm asking codex to chcek it - sometimes it's using python to do it.
I checked my shell options - ls, grep, sed - this should be available. Gemini or Claude CLI have no issues here.
I changed approval to full - same. Codex is just giving me code to paste and saying:
If you want, I can apply this change directly, but my current environment can’t read files. Paste the body of DashboardView here, or grant me a quick project scan, and I’ll patch it for you.
Token usage: total=10046 input=4202 (+ 55936 cached) output=5844 (reasoning 4864)
What is the expected behavior?
Codex should read/edit files.
What do you see instead?
_No response_
Additional information
_No response_
7 Comments
Thanks for your message. Can you provide me the logs that you have on those sessions ?
For this:
export RUST_LOG="warn,codex_core=trace,codex_tui=trace"~/.codex/log/codex-tui.logif you are using a terminalOK. I turned on logs. But I need to wait for these errors.
What changed.
After asking for summary about my codebase - codex started editing files by ... using workaround with python scripts. It's now instead of LS, SED using small python scripts to do that.
But I was able to get some errors with new session and new task (just for this case).
` Proposed Command
└ /usr/bin/grep -RIN "card|Card|cardsOrder|order" XXX/SUI/Features/Dashboard XXX/SUI/Common | head -n 50
✔ You approved codex to run /usr/bin/grep -RIN "card|Card|cardsOrder|order" XXX/SUI/Features/Dashboard... this time
• Ran /usr/bin/grep -RIN "card|Card|cardsOrder|order" XXX/SUI/Features/Dashboard XXX/SUI/Common | head -n 50
└ bash: head: command not found
grep: invalid option -- N
usage: grep [-abcdDEFGHhIiJLlMmnOopqRSsUVvwXxZz] [-A num] [-B num] [-C[num]]
[-e pattern] [-f file] [--binary-files=value] [--color=when]
[--context[=num]] [--directories=action] [--label] [--line-buffered]
[--null] [pattern] [file ...]
• Proposed Command
└ /usr/bin/grep -RIsn "card\|Card\|cardsOrder\|order" XXX/SUI/Features/Dashboard XXX/SUI/Common | /usr/bin/sed -n '1,80p'`
Now - grep started working because codex told me that it is starting to use absolute paths for commands. But ask you can see - the issue is with "head"
I've sent you mail with new logs. Same issue with 0.31.0
For anyone running into this problem, here is my case
The Codex cli always runs commands by calling:
bash -lc "your command"
(for example, bash -lc "ls -la" or bash -lc "pwd").
If you’re using fish (or any shell other than bash) as your main shell, this can break if your ~/.bash_profile or ~/.bashrc forces bash to immediately exec into another shell. In my case, my ~/.bash_profile looked like this:
Because of the exec /bin/zsh -l, bash never actually ran the command — it just switched over to zsh and stopped, causing empty output for codex cli
Fix:
Check your ~/.bash_profile or ~/.bashrc for any lines like exec /bin/zsh -l (or exec fish -l) and remove them. After I removed that line, Codex worked perfectly again, even though my main shell is still fish.
Codex is stuck for me when I run the /init command.
I only get this:
Exploring
└ List ls
And it keeps there forever.
I'm using Zsh as terminal.
Thank you @minhluuquang!. I was doing this in my .profile which caused it.
This bug report is very old and likely stale. Closing.