Codex can't use chruby
Open 💬 8 comments Opened Sep 1, 2025 by mikz
💡 Likely answer: A maintainer (dedrisian-oai, contributor)
responded on this thread — see the highlighted reply below.
What version of Codex is running?
0.1.2505291658
Which model were you using?
gpt-5
What platform is your computer?
Darwin 24.6.0 arm64 arm
What steps can reproduce the bug?
Set up chruby for a SHELL (bash/zsh).
Pick a ruby version like chruby 3.3.1
Working chruby shows active Ruby:
$ chruby
ruby-3.1.4
ruby-3.2.2
ruby-3.3.0
* ruby-3.3.1
ruby-3.3.6
ruby-3.3.7
ruby-3.4.1
ruby-3.4.2
Run in the parent shell:
env | grep ruby
And see ruby on the PATH:
PATH=/Users/mikz/.gem/ruby/3.3.1/bin:/Users/mikz/.rubies/ruby-3.3.1/lib/ruby/gems/3.3.0/bin:/Users/mikz/.rubies/ruby-3.3.1/bin/Library/Frameworks/Python.framework/Versions/3.12/bin:/opt/homebrew/bin:/opt/homebrew/sbin:./node_modules/.bin:./lua_modules/bin:/Users/mikz/.bin:/Users/mikz/.cargo/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/opt/X11/bin:/Library/Apple/usr/bin
RUBY_ROOT=/Users/mikz/.rubies/ruby-3.3.1
RUBY_ENGINE=ruby
GEM_ROOT=/Users/mikz/.rubies/ruby-3.3.1/lib/ruby/gems/3.3.0
GEM_HOME=/Users/mikz/.gem/ruby/3.3.1
GEM_PATH=/Users/mikz/.gem/ruby/3.3.1:/Users/mikz/.rubies/ruby-3.3.1/lib/ruby/gems/3.3.0
Run codex with prompt run "env | grep ruby and it will mangle PATH so the /usr/bin is before the /Users/mikz/.rubies like:
PATH=/Library/Frameworks/Python.framework/Versions/3.12/bin:/opt/homebrew/bin:/opt/homebrew/sbin:./node_modules/.bin:./lua_modules/bin:/Users/mikz/.bin:/Users/mikz/.cargo/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/
sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/opt/X11/bin:/Li
brary/Apple/usr/bin:/usr/local/MacGPG2/bin:/Applications/Wireshark.app/Contents/MacOS:/Applications/VMware
Fusion.app/Contents/Public:/usr/local/share/dotnet:~/.dotnet/tools:/Users/mikz/.gem/ruby/3.3.1/bin:/Users/mikz/.rubies/ruby-3.3.1/lib/ruby/gems/3.3.0/bin:/Users/mikz/.rubies/ruby-3.3.1/bin:/usr/local/heroku/bin:/Users/mikz/.qlty/bin:/Users/mikz/
Library/Preferences/netlify/helper/bin:/usr/local/opt/qt@5.5/bin:/Users/mikz/perl5/bin:/Library/Frameworks/Python.framework/Versions/3.12/bin
What is the expected behavior?
Codex to keep PATH unmangled.
What do you see instead?
PATH being overridden and mangled in a way that things that were on the start are at the end.
Additional information
Tried with bash and zsh with the same result.
8 Comments
Thanks! We're tracking this.
Is there some suggested workaround? Some parts of the PATH seem to stay in front and some get pushed to the end. What's the logic? Or I guess I could create some binstubs and place them at the right place.
I've confirmed it works the same on 0.27.0
Same thing with asdf. Ideally codex uses the same exact path / environment as I have when I launch it.
Same thing with mise:
sandbox restrictions, so I can’t execute the test myself.
Seems like Codex is useless for Ruby as of now.
Works fine with mise and
eval "$(mise activate bash)"in~/.profile, it can be used as a workaround.☝️ seems like the workaround above stopped working around 0.5x.x version? 🤔 possibly related issue #5837
In case it's helpful, codex 0.53.0 works with chruby on Ubuntu 24.04 (running in a WSL 2 VM). I can, however, reproduce the issue on macOS 26.0.1. So, I'm guessing it has something to do with the macOS platform, and/or homebrew, etc.
I have a similar issue with rvm.