# CLAUDE_CODE_TMPDIR

> It moves the folder where Claude Code keeps scratch files.

**Field:** Artificial Intelligence  
**Category:** Claude Code  
**Also known as:** CLAUDE_CODE_TMPDIR=/var/tmp

## Think of it like

It is like you choose which drawer holds your scrap paper.

## Definition

CLAUDE_CODE_TMPDIR moves the folder Claude Code uses for its own scratch files. Claude Code adds a folder of its own under it, named after your user on Mac and Linux. By default it is /tmp on a Mac and the system temp folder elsewhere. Project settings ignore it.

## Example

Jack's server has a tiny /tmp that fills up. He points this at a bigger disk.

## Example code

```bash
export CLAUDE_CODE_TMPDIR=/var/tmp
claude
```

Keep scratch files off a small /tmp.

## Why it matters

A full or locked temp folder can break tools in strange ways.

## Common mistake

Expecting every Bash command to use it. Commands outside the sandbox keep your shell's own temp folder.

## Three principles

- **Moves scratch files.** Claude Code's own.
- **Adds its own folder.** Per user.
- **Not project settings.** Shell or user.

## Related terms

- [CLAUDE_CONFIG_DIR](https://learn.benibix.com/term/ai/claude-config-dir-variable)
- [Bash Tool](https://learn.benibix.com/term/ai/bash-tool)

---

Source: https://learn.benibix.com/term/ai/claude-code-tmpdir-variable
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-16
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
