Skip to content

PATH is overwritten inside of the sandbox #622

Closed

Description

@mcolyer

What version of Codex is running?

0.1.2504221401

Which model were you using?

o4-mini

What platform is your computer?

darwin | arm64 | 24.4.0

What steps can reproduce the bug?

  • echo `ruby --version`
    
    • 2 reasoning | 1 tool

What is the expected behavior?

That it respects my rbenv path. It looks like seatbelt might be overriding the PATH which forces the system ruby.

What do you see instead?

 /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/boots
    trap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:

(stripped my personal paths at the end there)

Additional information

Happy to solve this another way, the goal is just to be able to us the proper ruby here.

Activity

  1. Githubradiphone5 commented on Apr 24, 2025

    @Githubradiphone5
  2. barelyknown commented on Apr 26, 2025

    @barelyknown

    This isn't a good solution, but for now you can have it run eval "$(rbenv init -)"; COMMAND GOES HERE

  3. barelyknown commented on Apr 27, 2025

    @barelyknown

    I put the following in my ~/.codex/instructions.md and it seems to work fine for now.

    Add this to the front of any shell command. It will ensure that rbenv is loaded and the correct Ruby version is used.
    
    `eval "$(rbenv init - zsh)";`
  4. seiyab commented on Jul 18, 2025

    @seiyab

    I'm using mise and codex can't execute npm.

  5. seiyab commented on Jul 18, 2025

    @seiyab

    Can we configure bash profile for codex?

  6. seiyab commented on Jul 18, 2025

    @seiyab

    I searched documents and found:

    • We can set environment variables as configuration
      • Update: It didn't work in my environment. Maybe its also a bug?
        • Environment:
          • Linux 6.10.14-linuxkit aarch64 unknown
          • It is a docker container on macOS Darwin 24.5.0 arm64 arm
    • PATH should be inherited by default. So this issue is labelled as a bug.

    https://github.com/openai/codex/blob/9846adeabf8593458bc9e3cef28e0dd6c89a59d1/codex-rs/config.md#shell_environment_policy

  7. codex-maintainers commented on Aug 7, 2025

    @codex-maintainers

    Thank you for the feedback! Please try again on the latest version of Codex CLI. If the issue persists, we'd appreciate a report or contribution to the codex-rs/ implementation. You can find more information in our project update: #1174.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions