LTspice on Linux
LTspice is a Windows application. There is no official Linux build. mcltspice solves this by running LTspice through Wine in headless batch mode --- no GUI, no display server, no X11 forwarding required. This page explains the key pieces of the stack and how they fit together.
Wine and batch mode
Section titled “Wine and batch mode”Wine is a compatibility layer that runs Windows executables on Linux. mcltspice invokes LTspice through Wine with the -b (batch) flag:
wine XVIIx64.exe -b circuit.cirThe -b flag tells LTspice to run the simulation, write the results to a .raw file, and exit. No GUI window is created. This works in headless environments --- SSH sessions, containers, CI pipelines --- anywhere you can run a shell command.
The WINEPREFIX
Section titled “The WINEPREFIX”Every Wine installation operates within a “prefix” --- a directory that acts as a virtual Windows filesystem. It contains the registry, drive letter mappings (the C:\ drive), and any DLLs the application needs.
mcltspice auto-detects the Wine prefix from the LTSPICE_DIR path. If your LTspice files are at /home/user/ltspice/extracted/ltspice, the prefix is expected at /home/user/ltspice/extracted/ltspice/.wine.
You create the prefix once during setup:
export WINEPREFIX=/path/to/ltspice/.wineexport WINEARCH=win64wineboot --initAfter that, mcltspice sets WINEPREFIX automatically before each simulation run. You do not need to manage it.
Binary .raw files
Section titled “Binary .raw files”LTspice writes simulation results to binary .raw files. These are not human-readable --- they use a compact binary format specific to LTspice.
mcltspice’s raw_parser module reads these files by parsing:
- The header --- plain text at the top of the file containing the title, simulation type, variable names, variable types (voltage, current, frequency), and the total number of data points.
- The binary data block --- IEEE 754 double-precision floats packed contiguously after the header. The parser reads the correct number of bytes based on the variable count and point count from the header.
For AC analysis, each data point is a complex number (real + imaginary parts stored as two consecutive doubles). The parser converts these to magnitude and phase automatically when you call get_waveform.
For transient analysis, values are real-valued doubles. The independent variable (time) may use a compressed encoding where LTspice only stores points where the waveform changes significantly, but the parser handles this transparently.
Simulation types
Section titled “Simulation types”LTspice supports several simulation types, each producing different data in the .raw file:
-
.tran (transient) --- Time-domain simulation. The independent variable is time; dependent variables are instantaneous voltages and currents. Used for oscillators, step response, switching converters.
-
.ac (AC analysis) --- Small-signal frequency response. The independent variable is frequency; dependent variables are complex-valued (magnitude and phase). Used for filter design, amplifier bandwidth, stability analysis.
-
.dc (DC sweep) --- Sweeps a source value and records the DC operating point at each step. Used for transfer characteristics and I-V curves.
-
.op (operating point) --- A single DC bias calculation with no sweep. Returns one set of node voltages and branch currents. Used to verify quiescent conditions.
-
.tf (transfer function) --- Computes small-signal gain, input impedance, and output impedance at DC. Returns scalar values, not waveforms.
-
.noise (noise analysis) --- Computes noise spectral density at each frequency point. The independent variable is frequency; dependent variables are noise voltage or current densities (V/sqrt(Hz) or A/sqrt(Hz)).
See Simulation Types for detailed coverage of each type, including directive syntax and which mcltspice tools work with each one.
Performance
Section titled “Performance”Typical simulation times:
| Circuit complexity | Simulation type | Approximate time |
|---|---|---|
| Simple RC filter | .ac (800 points) | 0.1 — 0.5 seconds |
| Op-amp circuit (10 components) | .tran (1ms) | 0.5 — 2 seconds |
| Switching converter | .tran (10ms, 100k steps) | 2 — 5 seconds |
| Monte Carlo (100 runs) | .tran or .ac | 10 — 60 seconds |
Wine overhead is minimal for batch mode. LTspice launches, runs the solver, writes the .raw file, and exits. The startup cost is roughly 50-100ms per invocation. For Monte Carlo or parameter sweeps, mcltspice runs LTspice once with stepped parameters rather than launching it repeatedly, which eliminates the startup overhead for multi-run analyses.
The main bottleneck is always the SPICE solver itself --- the matrix factorization and Newton-Raphson iterations that compute circuit behavior at each time step or frequency point.