Quick Start
Create a file named.wezterm.lua in your home directory with the following contents:
Configuration File Locations
WezTerm searches for your configuration file in the following order:1
Command Line Argument
Use the
--config-file CLI argument to specify a custom location:2
Environment Variable
Set the
WEZTERM_CONFIG_FILE environment variable:3
Windows Portable Mode
On Windows, WezTerm checks if
wezterm.lua exists in the same directory as wezterm.exe (useful for running from a USB drive).4
XDG Config Directory
If
$XDG_CONFIG_HOME is set:5
Standard Config Directory
Platform-specific standard locations:
- Linux/macOS
- Windows
6
Home Directory (Recommended)
The simplest option for single-file configurations:
- Linux/macOS
- Windows
Configuration File Structure
The configuration file is a Lua script that must return a configuration table:Using config_builder()
Thewezterm.config_builder() function creates a configuration object with built-in validation:
Configuration Reloading
WezTerm automatically watches your configuration file for changes:- Changes take effect immediately for most options
- Use
CTRL+SHIFT+Rto manually reload the configuration - Some options (like domain configurations) may require restart
Command Line Overrides
You can override configuration values via command line arguments:Multi-File Configurations
For complex configurations, organize your config across multiple files:Module Path Configuration
Lua’spackage.path is pre-configured with these directories:
~/.config/wezterm/~/.wezterm/- System-specific Lua module paths
Creating Modules
Create a helper module at~/.config/wezterm/helpers.lua:
helpers.lua
~/.config/wezterm/wezterm.lua:
wezterm.lua
Example Multi-File Structure
Per-Window Configuration Overrides
You can set window-specific overrides dynamically:Configuration Validation
WezTerm validates your configuration on load:If your configuration file has syntax errors or fails to load, WezTerm will display an error and use default settings.
Best Practices
1
Use config_builder()
Always use
wezterm.config_builder() for better error messages and validation.2
Avoid Side Effects
Don’t spawn processes or write files in the main configuration flow. Use event handlers instead.
3
Comment Your Config
Add comments explaining non-obvious configuration choices.
4
Version Control
Keep your configuration in version control (git) for easy backups and history.
5
Start Simple
Begin with a minimal configuration and add features as needed.
Troubleshooting
Configuration Not Loading
-
Check file location:
-
Verify Lua syntax:
-
Check WezTerm logs:
- Press
CTRL+SHIFT+Lto open the debug overlay - Look for error messages
- Press
Changes Not Taking Effect
- Manually reload:
CTRL+SHIFT+R - Some options require restart
- Check for command-line overrides that may conflict
Module Not Found
Ifrequire 'mymodule' fails:
- Verify file is named
mymodule.lua - Place in
~/.config/wezterm/or~/.wezterm/ - Check file permissions
- Verify no syntax errors in the module file