s to open).
Configuration File Location
Thesettings.json file is located in the application data directory:
Directory Structure
Surge organizes its files according to OS conventions:| Directory | Purpose | Linux | macOS | Windows |
|---|---|---|---|---|
| Config | settings.json | ~/.config/surge/ | ~/Library/Application Support/surge/ | %APPDATA%\surge\ |
| State | Database (surge.db), auth token | ~/.local/state/surge/ | ~/Library/Application Support/surge/ | %APPDATA%\surge\ |
| Logs | Timestamped .log files | ~/.local/state/surge/logs/ | ~/Library/Application Support/surge/logs/ | %APPDATA%\surge\logs\ |
| Runtime | PID file, port file, lock | $XDG_RUNTIME_DIR/surge/¹ | $TMPDIR/surge-runtime/ | %TEMP%\surge\ |
¹ Falls back to
~/.local/state/surge/ when $XDG_RUNTIME_DIR is not set (e.g., Docker/headless environments).Settings Structure
The configuration file is organized into three main categories:General Settings
Application behavior and UI preferences.Default directory where new downloads are saved.If empty, defaults to:
$XDG_DOWNLOAD_DIR(if set and exists)~/Downloads(if exists)- Current directory (fallback)
Show a warning when adding a download that already exists in the queue.Prevents accidentally downloading the same file multiple times.
Prompt for confirmation in the TUI when adding downloads via the browser extension.When
true, downloads from the extension require manual approval in the TUI. When false, they’re automatically queued (unless warn_on_duplicate triggers).In headless mode, this setting causes extension downloads to be rejected unless the extension sets
skip_approval.Automatically resume paused downloads when Surge starts.When enabled, all downloads with status
paused will be resumed on startup.Disable automatic check for new versions on startup.
Watch the system clipboard for URLs and prompt to download them.When enabled, Surge monitors the clipboard and shows a prompt when a URL is detected.
UI theme preference.Values:
0- Adaptive (follows system theme)1- Light2- Dark
Number of recent log files to keep.Older log files are automatically deleted on startup. Set to
0 to keep all logs.Network Settings
Connection and download behavior.Maximum concurrent connections allowed to a single host.Valid range: 1-64Higher values increase download speed but may be throttled or blocked by some servers.
Maximum number of downloads running simultaneously.Valid range: 1-10
Custom User-Agent string for HTTP requests.If empty, uses Surge’s default User-Agent. Some servers require specific User-Agent strings.
HTTP/HTTPS proxy URL for all downloads.If empty, uses system proxy settings.Supported formats:
http://proxy.example.com:8080https://proxy.example.com:8080http://user:[email protected]:8080
Download file pieces in strict order (Streaming Mode).Useful for previewing media files before download completes, but may be slower than parallel downloading.
Minimum size of a download chunk in bytes.Default:
2097152 (2 MB)Larger chunks reduce overhead but may waste bandwidth if connections stall.Value in bytes:
1048576 = 1 MB, 2097152 = 2 MBI/O buffer size per worker in bytes.Default:
524288 (512 KB)Affects memory usage and disk write performance.Performance Settings
Advanced tuning for reliability and speed optimization.Number of times to retry a failed chunk before giving up.Helps recover from temporary network errors or server timeouts.
Restart workers slower than this fraction of the mean speed.Valid range: 0.0-1.0Example:
0.3 means workers performing at less than 30% of average speed are restarted.Time to wait before checking a worker’s speed.Prevents premature restarts during connection establishment.
Value in nanoseconds:
5000000000 = 5 secondsRestart workers that haven’t received data for this duration.Helps recover from stalled connections.
Value in nanoseconds:
3000000000 = 3 secondsExponential moving average smoothing factor for speed calculation.Valid range: 0.0-1.0Lower values = smoother but slower to react to speed changes.
Higher values = more responsive but noisier.
Example Configuration
settings.json
Editing Settings
Via TUI (Recommended)
- Press
sin the TUI to open Settings - Navigate with arrow keys
- Press
Enterto edit a value - Changes are saved immediately
Via File Editor
- Open
settings.jsonin your preferred editor - Make changes following valid JSON syntax
- Save the file
- Restart Surge for changes to take effect
Migration & Compatibility
On Linux, Surge automatically migrates configuration from the legacy flat layout (~/.config/surge/*) to the XDG-compliant structure on first run:
surge.db→~/.local/state/surge/surge.dbtoken→~/.local/state/surge/tokenlogs/→~/.local/state/surge/logs/
~/.config/surge/settings.json.
Legacy “connections” and “chunks” sections in old configuration files are automatically migrated to the “network” section.