Directories
Directories
Section titled “Directories”Tuist organizes its files across several directories on your system, following the XDG Base Directory Specification. This provides a clean, standard way to manage configuration, cache, and state files.
Supported environment variables
Section titled “Supported environment variables”Tuist supports both standard XDG variables and Tuist-specific prefixed variants. The Tuist-specific variants (prefixed with TUIST_) take precedence, allowing you to configure Tuist separately from other applications.
Configuration directory
Section titled “Configuration directory”Environment variables:
TUIST_XDG_CONFIG_HOME(takes precedence)XDG_CONFIG_HOME
Default: ~/.config/tuist
Used for:
- Server credentials (
credentials/{host}.json)
Example:
# Set Tuist-specific config directoryexport TUIST_XDG_CONFIG_HOME=/custom/configtuist auth login
# Or use standard XDG variableexport XDG_CONFIG_HOME=/custom/configtuist auth loginCache directory
Section titled “Cache directory”Environment variables:
TUIST_XDG_CACHE_HOME(takes precedence)XDG_CACHE_HOME
Default: ~/.cache/tuist
Used for:
- Plugins: Downloaded and compiled plugin cache
- ProjectDescriptionHelpers: Compiled project description helpers
- Manifests: Cached manifest files
- Projects: Generated automation project cache
- EditProjects: Cache for edit command
- Runs: Test and build run analytics data
- Binaries: Build artifact binaries (not shareable across environments)
- SelectiveTests: Selective testing cache
Example:
# Set Tuist-specific cache directoryexport TUIST_XDG_CACHE_HOME=/tmp/tuist-cachetuist cache
# Or use standard XDG variableexport XDG_CACHE_HOME=/tmp/cachetuist cacheState directory
Section titled “State directory”Environment variables:
TUIST_XDG_STATE_HOME(takes precedence)XDG_STATE_HOME
Default: ~/.local/state/tuist
Used for:
- Logs: Log files (
logs/{uuid}.log) - Locks: Authentication lock files (
{handle}.sock)
Example:
# Set Tuist-specific state directoryexport TUIST_XDG_STATE_HOME=/var/log/tuisttuist generate
# Or use standard XDG variableexport XDG_STATE_HOME=/var/logtuist generatePrecedence order
Section titled “Precedence order”When determining which directory to use, Tuist checks environment variables in the following order:
- Tuist-specific variable (e.g.,
TUIST_XDG_CONFIG_HOME) - Standard XDG variable (e.g.,
XDG_CONFIG_HOME) - Default location (e.g.,
~/.config/tuist)
This allows you to:
- Use standard XDG variables to organize all your applications consistently
- Override with Tuist-specific variables when you need different locations for Tuist
- Rely on sensible defaults without any configuration
Common use cases
Section titled “Common use cases”Isolating Tuist per project
Section titled “Isolating Tuist per project”You might want to isolate Tuist’s cache and state per project:
# In your project's .envrc (using direnv)export TUIST_XDG_CACHE_HOME="$PWD/.tuist/cache"export TUIST_XDG_STATE_HOME="$PWD/.tuist/state"export TUIST_XDG_CONFIG_HOME="$PWD/.tuist/config"CI/CD environments
Section titled “CI/CD environments”In CI environments, you might want to use temporary directories:
# GitHub Actions exampleenv: TUIST_XDG_CACHE_HOME: /tmp/tuist-cache TUIST_XDG_STATE_HOME: /tmp/tuist-state
jobs: build: runs-on: macos-latest steps: - uses: actions/checkout@v4 - run: tuist generate - name: Upload logs if: failure() uses: actions/upload-artifact@v4 with: name: tuist-logs path: /tmp/tuist-state/logs/*.logDebugging with isolated directories
Section titled “Debugging with isolated directories”When debugging issues, you might want a clean slate:
# Create temporary directories for debuggingexport TUIST_XDG_CACHE_HOME=$(mktemp -d)export TUIST_XDG_STATE_HOME=$(mktemp -d)export TUIST_XDG_CONFIG_HOME=$(mktemp -d)
# Run Tuist commandstuist generate
# Clean up when donerm -rf $TUIST_XDG_CACHE_HOME $TUIST_XDG_STATE_HOME $TUIST_XDG_CONFIG_HOME