# Command line interface for KiCAD

Is there a way to produce Gerber files from command line in KiCAD (Linux/Unix) or a tool which can do it for me? The same question for SPICE netlist and BOM xml? I need it to automate this process within a CI-pipelie. GUI is not useable here.

It is possible to export Gerbers from Pcbnew with the Python Interface, as described here (with some adaption).

import pcbnew

# Load board and initialize plot controller
pc = pcbnew.PLOT_CONTROLLER(board)
po = pc.GetPlotOptions()
po.SetPlotFrameRef(False)

# Set current layer
pc.SetLayer(pcbnew.F_Cu)

# Plot single layer to file
pc.OpenPlotfile("front_copper", pcbnew.PLOT_FORMAT_GERBER, "front_copper")
print("Plotting to " + pc.GetPlotFileName())
pc.PlotLayer()
pc.ClosePlot()


This can obviously be expanded to include all of the required layers for your output.

It's worth looking at the scripting reference to see if there's anything to help you further there.

Because netlists are handled by eeschema, it's unlikely you're going to be able to script that. Pcbnew can export BOMs, but it doesn't look like there is any way to export from the python interface.