How to make Kicad schematic libraries load with a relative path

I am collaborating on a project and decided I was going to do this the right way, using git. I have put the entire project into a git repo, and merging a kicad schematic or PCB is actually not that bad surprisingly.

I am in the process of getting my libraries cleaned up and put into a git repo as well. But as I was adding libraries to Kicad I found that I couldn’t add kicad schematic component libraries files with a relative path, see below.

This isn’t a huge headache, but then you need to ignore these files and have every member of the project add the libraries seperately.

Does anyone know a way around this?

Well, I should have tried a bit harder before posting this. I figured this out, so since this post is already here, this is the correct way to do this (or seems to be the correct way to me anyway)

Add a user defined search path from the component libraries menu by navigating the the folder you want to use and selecting that folder. You are then prompted to use a relative path, click yes.

Kicad will now search this location for libraries. In order to add the libraries that exist there to the project you need to edit the .pro file of your project. I did this using a text editor, because I couldn’t figure out how ot do it through the Kicad GUI. Just add the name of the library you want to add to the list of libraries in the .pro file. If your library is called “MyLib” then see example below.

The one thing I haven’t figured out yet is how to tell Kicad to look in your library first if you have a library named the same as a default kicad library (default kicad libraries live in “Program Files\KiCad\share\kicad\library” for me, I am running Kicad 4.0.2 on Windows 10.

Does anyone know the right way to do this if you wanted to not use the Kicad standard libs? I could just delete the files located in that folder but that seems like the wrong way to do that.

Also, every library in the standard kicad libs folder has a .DCM file as well, what does this file do?

Don’t add it at #30, but at #1 :wink:

Btw, any device that appears more than once in different libraries… like you got a custom Resistor that’s called ‘R’ like the one in the standard devices lib… depending on the order of libs in that list in the .pro file, that device is taken… NO MATTER WHAT.

Next trouble is when you change stuff around and KiCAD wants to rescue stuff upon opening a schematic… fun times :wink:

If you do use KiCAD for more than the odd hobby project (and you sound like you are) get rid of the original libraries in the template folder in… that’s the list that’s been taken when you create a new project… change that one to how you need it set up.
You keep the original lib files, you only remove the links to them.

C:\Program Files\KiCad\share\kicad\template…

The master list for the footprints is elsewhere, same thing… if you want to play ball, get rid of the standard stuff and roll your own (as you’re already doing). Location of the fp-lib-table file:


We had a thread about this setup 2-3 weeks ago on here… I posted some more details in it… search for it.

1 Like

Thanks for the information, that makes a lot of sense. I will cleanse the standard libs on my local machine. Still isn’t a great path forward to try and set up other PCB developers with my project since they have to edit those files locally on their machines too, and it is hard enough to get people to make the switch to kicad to begin with I am trying to make this as painless as possible for them, because I really like Kicad.

I am currently battling trying to get my own footprint libraries up and running with Kicad AND bitbucket.

I want the project to be a standalone project that can reference my footprint libraries using a relative path so that myself as well as other developers can use exactly the same directory structure when we load the repos from bitbucket without having to mess around without having to edit the fp-lib-table. Again the ease of deployment for a new PCB developer.

I use bitbucket and mercurial so I can’t use the github features built into Kicad (even if I could I would prefer not to). However I can’t seem to figure out how to do what I did with schematic libraries with footprint libraries.

Any advice?

1 Like

symbol libs are old style… footprint repos are new style.
The footprints are .kicad_mod files in .pretty folders (those are the fp-libs).
The fp-lib-table file has the local paths and repos listed.

My fp-lib-table looks like this:

(lib (name Connectors)(type KiCad)(uri E:\Data_KiCAD\_KiCAD_Footprints\Connectors.pretty)(options “”)(descr “”))
(lib (name LEDs)(type KiCad)(uri E:\Data_KiCAD\_KiCAD_Footprints\LEDs.pretty)(options “”)(descr “”))
(lib (name Modules)(type KiCad)(uri E:\Data_KiCAD\_KiCAD_Footprints\Modules.pretty)(options “”)(descr “”))
(lib (name Others)(type KiCad)(uri E:\Data_KiCAD\_KiCAD_Footprints\Others.pretty)(options “”)(descr “”))
(lib (name SMDx)(type KiCad)(uri E:\Data_KiCAD\_KiCAD_Footprints\SMDx.pretty)(options “”)(descr “”))
(lib (name SODx)(type KiCad)(uri E:\Data_KiCAD\_KiCAD_Footprints\SODx.pretty)(options “”)(descr “”))
(lib (name SOTx)(type KiCad)(uri E:\Data_KiCAD\_KiCAD_Footprints\SOTx.pretty)(options “”)(descr “”))

I understand that much. I have gotten my own footprint libraries working on my local machine.

But I wanted to edit some file local akin to the .pro file to give a relative path to my footprint libs. It seems though that Kicad only references the fp-lib-table for footprints though, which isn’t in my directory (and therefore can’t be added to my repo)

Is there a way to have Kicad point to my own fp-lib-table that lives in the same directory as my project files?

Something like this:


but for [cvpcb] instead

Hm you really make me do it :slight_smile: … for the symbols the this seems to be done in the file in the templates folder.
You posted it above…

Thing is EEschema is still awaiting refurbishment, while PCBnew did receive the treatment already.

For the ‘new’ system there are environmental variables defined. We have:

  • KISYS3DMOD - path to 3d model parent folder (set to somewhere in the share folder of KiCAD on C:…)
  • KISYSMOD - path to footprint parent folder (set to somewhere in the share folder of KiCAD on C:…)

I just did the modification and then added a local personal library with the wizard.
Result looks like this (PCBnew > Perferences > Footprint Libraries Manager)

The fp-lib-table in the C:\Users\JonDoe\AppData\Roaming\kicad folder looks like this then:

(lib (name a)(type KiCad)(uri E:\Data_KiCAD_KiCAD_Footprints\a.pretty)(options “”)(descr “”))
(lib (name Connectors)(type KiCad)(uri E:\Data_KiCAD_KiCAD_Footprints\Connectors.pretty)(options “”)(descr “”))
(lib (name LEDs)(type KiCad)(uri E:\Data_KiCAD_KiCAD_Footprints\LEDs.pretty)(options “”)(descr “”))
(lib (name Modules)(type KiCad)(uri E:\Data_KiCAD_KiCAD_Footprints\Modules.pretty)(options “”)(descr “”))
(lib (name Others)(type KiCad)(uri E:\Data_KiCAD_KiCAD_Footprints\Others.pretty)(options “”)(descr “”))

(lib (name xQFP)(type KiCad)(uri E:\Data_KiCAD_KiCAD_Footprints\xQFP.pretty)(options “”)(descr “”))
(lib (name b)(type KiCad)(uri “$(KISYSMOD)\a.pretty”)(options “”)(descr “”))

So to reiterate… to get a similar functionality for the footprints as with the symbols I did set the environmental variable for the FPs and 3D models in Windows directly (Start > Control Panel > System > “Computer Name etc… Change settings to the right” > (new window) Advanced (tab) > Environment Variables (button).
There in the lower window you’ll find 3 KiCAD variables…

I think you can also change the ones in KiCAD (Preferences > Configure Paths), since they seem to be the same path variables. I didn’t check that avenue… might be more convenient if it works as well.

Anyhow, the fp-lib-table then get’s the path from the variable instead of directly, just that you have the varialbe/path not with the lib list but in a separate location.

I tried doing exactly this! My problem was I forgot the parens around KISYSMOD when I edited the fp-lib-table.

syntax wins every time. Thanks!

1 Like

That file will be created and populated when you put anything into the Description field in the symbols properties dialog.

1 Like

Thanks for the knowledge!


I have found an issue in 4.0.2 where I have used the kicad_common file in my appdata/roaming directory to edit the KISYSMOD and KISYS3DMOD envrionment variables. When opening Pcbnew from an existing project (all instances of Kicad were closed), I check Footprint Libraries Manager and find that those two environment variables have changed to their default location which differs from my entered values on kicad_common. I get out of that manager and then go under Configure Paths, the env. variables are as I entered in kicad_common. I go back in the Footprint Libraries Manager and the variables are fixed.

As an experiment I go under my windows settings and add the Kicad variables under my OS environment variables. Ever since I have done this, I have not been seeing this problem. Can anyone else confirm with version 4.0.2 and Windows 10? Thank you!

  • Bob