Location of User Global Libraries by Symbol Editor

KiCad 5.1.2-1 , Windows 7

In my first project (finished and Gerber files sent), I started creating symbols by using “Symbol Editor”.
Every time I defined a new library, I was asked to select “Global” or “Project”; I selected “Global” always.

Before starting my second project I would like knowing:
Why are the new/user global libraries placed in the project folder/directory?

I mean; I thought that the “Project” ones only will be found in the project folder (I say this though I didn’t create yet a project library). And, in case of the user “Global” ones, the user could be asked, likely once, to choose/create his global libraries directory.

Thank you.

Doesn’t this imply that the user cannot create two libraries, “Global” and “Project”, having the same name?

“Global” are added to the library table (a list of libraries) which is the same for all projects and the libraries listed there are available for all projects. “Local” are added to the local library table, that list is stored inside the project and is seen by that project only. Where the libraries themselves reside isn’t relevant. You can add any library to one list or to both. Or those two lists may point to the same library or have a library with a same name but still two different libraries (actually I should check if this is true but I believe it’s so).

In short, Global and Local aren’t properties of libraries themselves and the library location doesn’t matter.

When you create a new symbol library with File->New Library the library is stored wherever you save it. If you want it to be available for all projects it would be natural to save it to a location which is easily available to all projects, not to a project folder. “Global” or “Local” means only that the new library is added to one list of available libraries, either in the global list (available to all projects) or to the local list (available only to the current project).


Global vs local means to which context inside of kicad something is added not where on the filesystem (kicad does not care where you put libs it only cares how you add them to kicads setup)
See: Library management in KiCad version 5

When creating a new library you are not only asked if you want to place it into the global or local context but also for a file system location.

1 Like

So I wish, for new KiCad users in the least, that the dialog “Global or Project” could be made to appear before the one to specify, in case the user selects “Global” for the first time, the path of the new library . If “Project” is selected, the path is already known I guess.

Not really. Again: KiCad does not care where you place libraries inside the filesystem. project specific libs do not need to live in the project directory.
KiCad is also perfectly fine with you adding a library inside a project folder to the global context.

The good thing about kicad is that it is flexible. (Because this means you can do with it what ever the ■■■■ you want.) The bad thing about kicad is that it is flexible. (Because it means you are responsible to make a few decisions.)

By the way the default starting location for any file browser like tool is the project directory. Meaning as long as you do not want to add a new global library kicad already points you to the best possible place.

See it like this. If you use some word processor and select “save as” then it opens the file browser where you select the location of your file. KiCad just pushes this selection forward as it needs at least the library name to view it in the tree view. To add the library to either the global or local context it further needs to know where you saved it. (Meaning the “new library” entry is a combination of making a new thing and already saving it.)


I opened “sym-lib-table”
“1_MCU” is a global library I created and its entry in “sym-lib-table” is:

(lib (name 1_MCU)(type Legacy)(uri ${KIPRJMOD}/1_MCU.lib)(options “”)(descr “”))

Since “1_MCU” is actually in the folder of my first project, ${KIPRJMOD} is the project path.
I wonder what will happen when I will start my second project in a different directory (though inside KiCad tree).

Thank you.

Edit: I mean; will ${KIPRJMOD} is fixed for all subsequent projects or not?

KIPRJMOD will always point to the current project location. Meaning it will look for a 1_MCU lib inside your second project and most likely complain that it is not found. (The auto replacement with path variables is a useful feature but the KIPRJMOD variable might not be a good idea to be used by default in a global library. Bug report: https://bugs.launchpad.net/kicad/+bug/1830694)

Using KIPRJMOD in the global library table can be used if you know every project you want to make will have a 1_MCU library in it. (Again the flexibility of kicad allows for doing things that might not always be the best idea long term.)

1 Like

So, I guess, the best location that a user chooses for his global libraries is of the legacy libraries; that is: ${KICAD_SYMBOL_DIR}

In my case, it is “D:\KiCad512\KiCad\share\kicad\library”.

But I wonder what could be the drawback in doing this.
Thank you.

No. This is reserved for the official system libraries! (placing personal assets into the system libraries folder will mean you loose them on next update) Read my tutorial (linked above) it explains everything in great depth. TlDr: Make a special directory in your home directory for holding kicad libraries. (Examle a kicad-libraries folder with my-symbols, my-footprint, my-3dmod subfolders.)

1 Like

Sorry, I couldn’t get very well your two options, speaking practically:

There are two options from this point. Adding a project local library to a global library table could print a warning message that this is not considered a good idea or kicad could use the full path instead of path variables. (I lean towards the former as the most likely case here is a misunderstanding of kicads library system.)

On my side, I used creating a symbol for every item/element (also its footprint) which I may need. So I have many new libraries. So far, I can’t see the inconvenience to place my libraries in ${KICAD_SYMBOL_DIR}. And to be on the safe side, I make a backup of the last “sym-lib-table”, just in case it will be overwritten by a future update, so that I can also update it in my turn. Obviously, I have to also substitute ${KICAD_SYMBOL_DIR} for ${KIPRJMOD} on the actual one that I have now.

In any case, I don’t see how a user can share a project with someone else while their “sym-lib-table” are supposed to be different.

I suggest this easy solution:
While working on a project, KiCad looks for a library in the project directory first. if not found, it looks in the legacy global one. So if there are two libraries of the same name, the priority is for the one in the project folder.
For instance, in this case, there will be no real need of ${KIPRJMOD}; other than signalling that the library is new, hence it could be located in the project or legacy directory (if not both). And the user “Global option” could be removed. And when updating the legacy folder(s), the previous legacy files only are updated and new ones added (leaving any extra files as they are). In case the files format will be changed, the user will need to update his libraries (the added ones) if possible or erase them.

It’s not about “inconvenience”. You should never add your own files (documents) into C:Program Files\ or to a comparable system folder. Store your own component libraries to some other location, like your Documents folder or C:\KiCad_libraries. Note that you can add a new path variable to KiCad with Preferences->Configure Paths. Add your symbol library folder there.

By using those handy path variables. For example user AA has the set of symbol libraries in C:KiCad_libraries. User BB has the same libraries in %user%\Documents\kicad-sym. AA has path variable ${OUR_SYM}=C:KiCad_libraries. BB has path variable ${OUR_SYM}=%user%\Documents\kicad-sym. Provided that their Global or Local (project) library tables are compatible and their libraries are identical, it magically works.

Their sym-lib-tables aren’t supposed to be different or identical. It’s enough that the needed libraries are listed in one of the tables with the same name for both users.


Does this directory have an environment variable too?

I guess, this answers my last question.

Edit: Now things are clear, thanks to you and Rene.

As @eelik already cleared up: yes you can add your own path variables. But this is not required. (You only need this if you intent to either use 3d models or have a portable setup. Otherwise simply use the full system path in your lib tables.)

I guess, I returned now to square one :frowning:
I was trying to ask:

In Preferences ==> Configure Paths
Could an added path have any variable name, as MyLibraries?

I think after reading the previous post (@Rene_Poschl), the answer is no.

Anyway and as a test, I started a new project by copying the previous one in a new directory. I also did the following:

[1] I copied all files, related to my symbols, and the folders, related to my modules, to my global directories:

[2] In the new folder (new project), I deleted my libraries and modules which were copied from the previous one.

[3] I renamed the 6 KiCad files (their extensions below) using the one of their folder (their new project name):

[3] I updated the line “LIBS:*-cache” on the file *.sch to let LIBS point to the new *-cache.lib.

[4] I run Kicad as usual (shortcut on desktop).

[5] The previous project showed up. So I opened the new one.

[6] KiCad complained for not finding my libraries in the project folder (where they are supposed to be).

[7] By using *-cache.lib, as a rescue, KiCad drew the schematic properly.

From here, I have no clear idea on how to let KiCad, from now on, locate always my global libraries (moved into fixed directories) when I will start any project.

As a first attempt, I tried to change their paths on “Preferences ==> Manage Symbol Libraries”.


It worked.

So, perhaps, this is the solution which I couldn’t get earlier :eyeglasses:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.