How to initialize an empty KiCAD project on the command line

TL;DR:

Note: We recommend to use our new script to initialize a project with project-specific footprint and symbol libraries, see How to initialize your KiCAD project on the command line. The script on this page initializes an empty project without any libraries.

Inside the directory where you want to create the project, run

wget -qO- https://techoverflow.net/scripts/kicad-initialize.sh | bash /dev/stdin MyProject

You should replace MyProject (at the end of the command) with your project name.

*Note:*This will initialize an empty KiCAD project without any libraries. This is equivalent to creating a new project in KiCAD itself (using the GUI).

How it works

Our script is a simple bash script that creates the files that KiCAD creates when manually creating a new project.

It will create these files (MyProject is the default project name, but you can modify it using a command line argument):

The files are modelled after KiCAD 5.1.4 but we expect them to work with any recent KiCAD version.

#!/bin/bash
# TechOverflow KiCAD empty project initializer
# Usage: $0 <filename prefix>
if [ $# -ne 1 ]
then
    echo "Usage: $0 <filename prefix>"
    exit 1
fi

# Create project file
cat <<EOT > ${1}.pro
update=22/05/2015 07:44:53
version=1
last_client=kicad
[general]
version=1
RootSch=
BoardNm=
[pcbnew]
version=1
LastNetListRead=
UseCmpFile=1
PadDrill=0.600000000000
PadDrillOvalY=0.600000000000
PadSizeH=1.500000000000
PadSizeV=1.500000000000
PcbTextSizeV=1.500000000000
PcbTextSizeH=1.500000000000
PcbTextThickness=0.300000000000
ModuleTextSizeV=1.000000000000
ModuleTextSizeH=1.000000000000
ModuleTextSizeThickness=0.150000000000
SolderMaskClearance=0.000000000000
SolderMaskMinWidth=0.000000000000
DrawSegmentWidth=0.200000000000
BoardOutlineThickness=0.100000000000
ModuleOutlineThickness=0.150000000000
[cvpcb]
version=1
NetIExt=net
[eeschema]
version=1
LibDir=
[eeschema/libraries]
EOT

# Create schematic file
cat <<EOT > ${1}.sch
EESchema Schematic File Version 2
EELAYER 25 0
EELAYER END
\$EndSCHEMATC
EOT

cat <<EOT > ${1}.kicad_pcb
(kicad_pcb (version 4) (host kicad "dummy file") )
EOT

Run e.g. using

bash kicad-initialize.sh MyProject