Main page...           Popular tags: Electronics (12), Linux (11), DIY (8), Hack (8), Other (6), Retrocomputing (6), Debian (5), Curiosities (4)


Making KiCad work offline

2016-10-26 18:22:31,  In: Electronics, Linux

KiCAD is distributed in many Linux distributions repository or as Windows installer package. Unfortunately most of these installation types have one problem - they don't install, or don't register, component footprint libraries. These libraries used by CvPcb are downloaded from Git repository each time user launches CvPcb. Although theoretical goal of this approach was to offer the user always fresh libraries, in practice it results in few minutes of lag (when the files are downloaded) and few hundred MBs occupied on disk each time. More, if someone used a library which is not available anymore, e.g. has been renamed or joined with another, there will be error message. Or maybe you don't have access to the Internet? So you won't design a PCB. Let's get rid of this Git support at all and use locally-stored libraries updated on demand. In this tutorial both Windows and Linux screenshots will be used.

   Windows version

After launching KiCAD, create a blank project and open Eeschema. Now open CvPcb by clicking its button:


It will try to download GitHub footprints. We have to wait. Sometimes you may get error message like this:


This is normal. It means that your older configuration file (fp-lib-table) contains items which were on GitHub, but they are not there anymore. After CvPcb comes in, select Footprint Libraries from Preferences menu. You will see the window with libraries:


Notice items with GitHub plugin installed. Now select the topmost one and using Remove Library button remove all libraries with GitHub plugin. Usually it ends with removing all of them.
Now click Append with Wizard button to get a wizard, then select GitHub Repository and check Save local copy to with existing folder. Click Next


After all libraries have been downloaded, use Select All option. Files will be downloaded and installed. Few libraries may end with unsuccessful status, it's normal. It is only important to choose to add to global library visible by all projects. After importing, the window should look like this:


KISYSMOD variable points to footprints on disk. If you want to update your footprints, just repeat steps from this note.

   Linux

In Linux, at least in Debian, there is no easy way to load Git repository automatically from CvPcb as KiCad stores its libraries by default in a root user directory. Go here and download library-repos-install.sh file. Do not use BAT file in Windows as it's terribly outdated and will not run properly (outdated library names). Now make the file active by chmod a+x library-repos-install.sh in a directory you've downloaded it and launch it by announcing the following commands (it may require root password):
./library-repos-install.sh --install-prerequisites
./library-repos-install.sh --install-or-update

The script will download footprints and all libraries repository to hard disk in /home/.../kicad_sources/library-repos directory. If you don't want to use new libraries for components but only footprints (and still use component libraries you have on hard disk installed with KiCad), you can save about 600MB and remove kicad-library subdirectory. If you want to use new schematic libraries, add them to Eeschema Preferences -> Component Libraries window. It generally should not be deleted as KiCad may use the 3D footprints from there, but it doesn't do it always.
We will do some trick now. Because the library directory doesn't look good in home directory, we will have to hide it by renaming it with dot. But then we will not be able to select this directory while adding it to CvPcb. We will use KiCad's environmental variables. In main window of KiCad open Preferences then Configure paths. Change the KIGITHUB variable to the directory of downloaded libraries, here: /home/mcbx/kicad_sources/library-repos. We will not need it pointing to Github anymore. KiCad will substitute paths with the variable later and we will be able to change it.



Now launch Eeschema and CvPcb, confirm errors. Select Footprint Libraries from Preferences menu. Remove all GitHub plugin dependent libraries (what usually ends with removing all of them) and click Append with Wizard button. Click Next with Files on my Computer option selected.
Open the directory to which downloaded files have been stored, here it's /home/mcbx/kicad_sources/library_repos. select the first *.pretty subdirectory and move with down arrow to next ones looking at buttons below. Next button should be on. If it's grayed out when some *.pretty directory is selected, remove this directory in file manager. If you got to the end, select the first one again and move down with down arrow holding Shift key, selecting all *.pretty directories.


Click Next. Libraries will be verified, only add them To Global Library Configuration:


And it finally should look like this:


Now confirm the window, close CvPcb, close Eeschema, and modify KIGITHUB variable in main window (Preferences, Configure Paths) changing /home/.../kicad_sources/library-repos to /home/.../.kicad_sources/library-repos. Rename the folder accordingly to hide it.


Older post...       Main page       Newer post...