export vs Shell RC FilesWhy your Claude Code config disappears when you open a new terminal
You ran export commands, everything worked, then you opened a new terminal and it broke.
export commandsexport in terminalexport FOO=bar~/.zshrcexport FOO=bar to fileexport in terminal |
Added to ~/.zshrc |
|
|---|---|---|
| Analogy | Writing on a whiteboard | Writing in a notebook |
| Survives reboot? | No | Yes |
| New terminal? | Gone | Auto-loaded |
| VS Code terminals? | Not inherited | Inherited |
| Use case | Quick test | Permanent config |
~/.zshrc~/.bashrcThis only applies to VS Code terminals. If you use Claude Code from a standalone terminal, use the shell RC method.
Key It must be a new terminal. The old one still has them from your export.
Claude Code normally asks before running commands, editing files, etc. In a lab environment this gets tedious fast. YOLO mode lets it execute without asking. Don't use this on production code.
The VS Code Claude Code extension auth flow can be finicky. Much easier approach:
claude from the terminal~/.zshrc but not running source ~/.zshrc — current terminal won't see changes until you do~/.bashrc when your shell is actually zsh (macOS default) — check with echo $SHELL~/.zprofile instead of ~/.zshrc — VS Code terminals don't always source profile filesexport keyword — without it, child processes (like Claude Code) won't inherit the variable| Step | What to do |
|---|---|
| 1 | Check your shell: echo $SHELL |
| 2 | Add the 3 export lines to ~/.zshrc or ~/.bashrc |
| 3 | Run source on that file |
| 4 | Open a new terminal and echo each var to verify |
| 5 | Run claude and submit a prompt — if it responds, you're good |
Questions?