t3code icon indicating copy to clipboard operation
t3code copied to clipboard

[linux] can't find codex if installed via homebrew

Open lincolnthalles opened this issue 8 months ago • 20 comments

Codex provider status
Codex CLI (`codex`) is not installed or not on PATH.

Homebrew installs codex to /home/linuxbrew/.linuxbrew/bin but the program can't find it.

It also doesn't account for ~/.profile and ~/.bashrc for Linux, only for macOS via interactive shell.

Installing Codex elsewhere works.

lincolnthalles avatar Mar 07 '26 02:03 lincolnthalles

can you run echo $PATH on your general shell? or whereis codex

maria-rcks avatar Mar 07 '26 02:03 maria-rcks

also linked to #226

maria-rcks avatar Mar 07 '26 02:03 maria-rcks

@maria-rcks same issue here on MacOS, fish shell (might be an issue with shell)

↪ whereis codex
codex: /opt/homebrew/bin/codex

baggiiiie avatar Mar 07 '26 02:03 baggiiiie

same issue on MacOS:

> whereis codex
codex: /opt/homebrew/bin/codex

Da1sypetals avatar Mar 07 '26 02:03 Da1sypetals

under settings -> codex app server there's a setting to change codex binary path, does this work?

hwanseoc avatar Mar 07 '26 03:03 hwanseoc

under settings -> codex app server there's a setting to change codex binary path, does this work?

Thanks! But it does not work

Da1sypetals avatar Mar 07 '26 03:03 Da1sypetals

can you run echo $PATH on your general shell? or whereis codex

codex: /home/linuxbrew/.linuxbrew/bin/codex

lincolnthalles avatar Mar 07 '26 03:03 lincolnthalles

Retracted comments unrelated to this issue (see https://github.com/pingdotgg/t3code/issues/263 instead).

scode avatar Mar 07 '26 03:03 scode

under settings -> codex app server there's a setting to change codex binary path, does this work?

No. Also, the only way to access the settings is via Ctrl+,. There's no menu or button to the settings screen.

Image

lincolnthalles avatar Mar 07 '26 06:03 lincolnthalles

I have the same issue. A temporary fix I got from a helpful guy on Discord is to use a symlink: sudo ln -s /opt/homebrew/bin/codex /usr/local/bin/codex replace /opt/homebrew/bin/codex with the output of whereis codex

BSchoolland avatar Mar 07 '26 07:03 BSchoolland

Image

Same issue. Even did the symlink and it still fails

PunkUnknown avatar Mar 07 '26 08:03 PunkUnknown

I have the same issue. A temporary fix I got from a helpful guy on Discord is to use a symlink: sudo ln -s /opt/homebrew/bin/codex /usr/local/bin/codex replace /opt/homebrew/bin/codex with the output of whereis codex

this worked for me, thanks! i'm running bazzite dx.

rfrank14 avatar Mar 07 '26 10:03 rfrank14

I just installed codex and it is working, without running any other commands. Can you reinstall them again?

Bashamega avatar Mar 07 '26 12:03 Bashamega

Same issue when codex is installed via bun. T3 Code cannot find it, even when the path to codex binary is configured in settings

jelenv avatar Mar 07 '26 20:03 jelenv

When confirming symlink solution, make sure you test with a new thread. I was still having the same error on the thread I first discovered this issue and making a new thread confirmed that the symlink fix worked.

I'm on arch.

the-sides avatar Mar 09 '26 01:03 the-sides

I'm using Omarchy (Arch) and I had the same issue when using a packaged version from AUR ('yay -S tscode-bin`). I thought I was a bug on my system but I fixed it by implementing the bug fix I put up in #1100. I am not happy with the change requiring changes across 4+ files so not sure if it will be accepted but that is what worked for me.

Ryan-D-Gast avatar Mar 15 '26 03:03 Ryan-D-Gast

Link #301

DrLehman avatar Mar 15 '26 05:03 DrLehman

Having the same issue with the latest version but came here to add that reinstalling codex cleanly seems to have fixed it but the error message lingers and will not disappear even if I restart t3code

Image

davidsielert avatar Mar 16 '26 03:03 davidsielert

can y'all try this !!

  1. uninstall codex from brew, remove the ~/.codex dir too.
  2. make sure you're on the latest version of t3code.
  3. fresh install codex.
  4. keep the binary and home path empty, it should auto recognize.

lmk if this is working !!

shivamhwp avatar Mar 18 '26 10:03 shivamhwp

I used codex to help debug this issue and this is what it came up with. It solved the issue on my end (Bazzite).

"I tracked this down on Linux/Bazzite and the issue is not that codex is necessarily missing. The problem is that T3 Code is launched as a GUI AppImage, and GUI apps often do not inherit the same PATH as an interactive shell.

What was found:

  • codex was installed and worked fine in a terminal.
  • T3 Code still reported Codex CLI (codex) is not installed or not executable.
  • On this setup, codex was available through shell startup configuration, but T3 Code did not read that environment when launched from the desktop.
  • This is especially likely on immutable or desktop-managed Linux setups like Bazzite, where GUI app environment and shell environment can differ.

Temporary workaround:

  1. Create a launcher script that explicitly sets a PATH including common Linuxbrew and local bin locations before starting T3 Code:
 sh
 mkdir -p "$HOME/.local/bin"

 cat > "$HOME/.local/bin/t3-code-alpha-launcher" <<'EOF'
 #!/usr/bin/env sh
 set -eu

 export PATH="$HOME/.local/bin:$HOME/bin:/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:${PATH:-/usr/local/bin:/usr/bin:/bin}"
 export DESKTOPINTEGRATION=1

 exec "$HOME/AppImages/t3_code_alpha.appimage" --no-sandbox "$@"
 EOF

 chmod +x "$HOME/.local/bin/t3-code-alpha-launcher"
  1. Update the desktop entry so the app launches through that wrapper instead of directly launching the AppImage:
  mkdir -p "$HOME/.local/share/applications"

  cat > "$HOME/.local/share/applications/t3_code_alpha.desktop" <<'EOF'
  [Desktop Entry]
  Type=Application
  Name=T3 Code (Alpha)
  Comment=T3 Code desktop build
  Icon=$HOME/AppImages/.icons/t3_code_alpha
  TryExec=$HOME/.local/bin/t3-code-alpha-launcher
  Exec=$HOME/.local/bin/t3-code-alpha-launcher %U
  Terminal=false
  Categories=Development;
  StartupWMClass=T3 Code (Alpha)
  EOF
  1. Refresh desktop entries if available:

update-desktop-database "$HOME/.local/share/applications" || true

  1. Fully quit T3 Code and relaunch it from the application menu. If using a pinned icon in a taskbar/dock, unpin and re-pin it first, because some desktop environments cache the old Exec= command.

Optional extra hardening:

Add a codex shim in ~/.local/bin so that anything that sees only local user binaries can still resolve codex:

  cat > "$HOME/.local/bin/codex" <<'EOF'
  #!/usr/bin/env sh
  set -eu

  for candidate in \
      /home/linuxbrew/.linuxbrew/bin/codex \
      /var/home/linuxbrew/.linuxbrew/bin/codex
  do
      if [ -x "$candidate" ]; then
          exec "$candidate" "$@"
      fi
  done

  echo "codex wrapper could not find a Homebrew codex binary" >&2
  exit 127
  EOF

  chmod +x "$HOME/.local/bin/codex"

Suggested upstream fix:

T3 Code should not rely only on inherited PATH when validating or launching codex on Linux desktop builds.

A more robust approach would be:

  1. Try codex from the inherited PATH.
  2. If not found, probe a small set of common Linux install locations such as:
    • /home/linuxbrew/.linuxbrew/bin/codex
    • /var/home/linuxbrew/.linuxbrew/bin/codex
    • $HOME/.local/bin/codex
  3. Fix the codex binary path override option.
  4. In the AppImage/desktop launcher, prepend a known-safe PATH for common user-level install locations before spawning the backend.

That would avoid false “not installed” errors on systems where GUI apps and shell sessions do not share the same environment."

domainus avatar Mar 23 '26 13:03 domainus