Environment Variables Being Reset On Power Up Of PC

This is going to be long – I wanted to detail the problem as best I could, and outline what’s been done so far in the attempts to correct it, but without success.

This issue came up in another thread that was started for a completely different issue. As the title of that thread is not relevant, and this issue is buried deep under the original thread’s chatter, I figured it would be wise to start a new thread in hopes that more eyes will be on the problem and perhaps we can home in on a solution quicker.

I’m running 5.0.2 on a 64 bit Windows machine. I’m not sure if this is relevant or not but last year I had installed version 4 on the same machine, never really did much to start learning KiCad, and then late last year decided to install 5.0.2. I’m not sure if I uninstalled the version 4 properly, but I do recall a bit of fussing around and library tables causing me issues, however I thought I had all that sorted out until now. In fact, I have been happily designing my first PCB with 5.0.2 and even created a little personal library.

I then changed the libraries over from the installed ones, to a github clone on the pc, and then set up the environment variables to point to these libraries. All seemed to work fine, but ….
I did notice that when setting the environment variables in the Preferences>Configure Paths, I got this message that said “Warning! Some of the paths you have configured have been defined externally to the running process and will be temporarily overwritten.” More details box revealed “The next time KiCad is launched, any paths that have already been defined are honored and any settings defined in the path configuration dialog are ignored. If you did not intend for this behavior, either rename any conflicting entries or remove the external environment variable definition(s) from your system”
I blindly proceeded and then exited out of KiCad altogether, and sure enough, when I relaunched Kicad, the environment variables are all pointing back to the installation locations and not my github repo clones…

So, off I went to the Windows settings and deleted the kicad related environment variables once I was instructed by others that they are being set external to Kicad and that’s why they were greyed out in the dialog box for them inside KiCad.

Back into KiCad – the environment variables are no longer greyed out, which is a good sign, and I re set them to point to the github repo clone locations.

Everything works – UNTIL – I power off the machine, then power it up again, and go back into Kicad. They’ve been changed back to greyed out, pointing to the original installation locations again !

Wait – there’s more - If I then go out to the Windows settings and go into the environment variable settings – there are no kicad related environment variables there – makes sense, as I deleted them earlier. BUT – if I then exit that, and go back into Kicad – the environment variables are now back to pointing to the github repos as I want them to be !!! WTF ???

Some very helpful people with far more knowledge on this than me, have suggested that perhaps there are some remnants in the Windows registry, but looking in there just made me very afraid I was going to end up bricking my computer so I quickly left.

So, sorry for the long winded explanation, but that’s where I am – No Kicad environment variables in the Windows environment variable dialog setting, but Kicad is being reset back to the original installation values when the PC is powered off and then on again. Simply going into the Windows environment variable dialog and “looking” and then exiting, results in the right environment variables being present in KiCad when Kicad is then launched……

Help !

1 Like

May be there is a combination of OS Global Environment, User Environment, and “%USERPROFILE%\AppData\Roaming\kicad\kicad_common” file. You should find your path in this kicad_common file.

Hi - thanks for the input. I dug into the kicad_common file. Here’s the contents -

kicad_3Dlib_last_download_dir=C:\Program Files\KiCad\share\kicad\modules\packages3d
WorkingDir=C:\Program Files\KiCad
Editor=C:\Program Files\Notepad++\notepad++.exe
KICAD_SYMBOL_DIR=C:\XPS Data\KiCad Libraries\Official\kicad-symbols
KICAD_TEMPLATE_DIR=C:\XPS Data\KiCad Libraries\Official\kicad-templates
KISYS3DMOD=C:\XPS Data\KiCad Libraries\Official\kicad-packages3D
KISYSMOD=C:\XPS Data\KiCad Libraries\Official\kicad-footprints

The “XPS Data” are in fact the settings I entered for the environment variables…

Well this is damned weird. I just powered up the computer and now the KiCad environment variables are working - i.e. the settings I made to point them to the github repos on my machine are persisting between power cycles of the machine. Don’t know what to expect next… I’ve been monkeying around with the windows system viewing the environment variables but didn’t change anything…at least that I am aware of…

I’ll report back again after I’ve had some sleep !

ok - so I left the computer off and went to bed last night, and today I fired it up and figured that the same gremlins that were tormenting me would be back to enjoy themselves again…but no - the Kicad software is working as it should - i.e. I fire up the PC and then go straight to KiCad and all the environment variables are what they should be, (not reset to installation ones and greyed out).

Not sure where this leaves me. I am quite sure I did nothing that “deleted” anything to cause this to suddenly work properly, so perhaps there is something in the bowels of the software or windows that somehow corrected itself. I hate stuff like this cause it usually comes back to wreak havoc later, but I am not sure what I can do past this point as there is nothing to really “investigate” now. I am going to rename the Kicad installation library folder though - at least that way, if the env. variables get reset I will quickly see when it can’t access where it thinks the libraries are located.

I would like to know something that perhaps others can enlighten me on if they read about this. When one uninstalls KiCad, does it strip out literally every trace of KiCad on the computer as far as things being set at the operating system level? Except for things like project folders that are off “outside” of the KiCad installation directories. Maybe there’s a document that describes all this that I have not found yet. If so, please point me to it. Things like system level environment variables etc.? @Rene_Poschl mentioned that he’s going to confirm that the KICad 5 no longer sets up these operating system level environment variables when he has the chance.:+1:

I can’t remember the options that are presented when you install KiCad onto the PC, but I do remember there were a bunch of tick boxes that at the time we’re not understood by be so I left the defaults. Maybe there are options there that “next time” I do an install I can be more selective.


1 Like

It does not delete anything outside of the program folder.

Meaning your personal projects and libraries are save as long as you place them somewhere within your users home directory.
Even kicad settings files (like the library tables) are save as they are out of reach for installers (and uninstallers)

So I just tried out the Template feature of new>project from template. It appeared that the old environment variables gremlins were back to have fun with me when a bunch of errors flashed up on the screen.

Upon closer inspection it looks like there is a subfolder in the github template repo called “CMakeModules” that has nothing but a single file in it, so no meta data. The errors were due to no meta data.

Is this some old outdated template folder that has been going along for the ride with various releases ? I was thinking I’d just delete it, but then again, next repo refesh, it would probably come back again - :grin:

Now that I know what it is, I can just ignore it, but might be nice to not see the errors light up on the screen when selecting a template…


The CMakeModules stuff is used to generate the packages and installers of KiCad.

I have never tested if the template stuff works when used directly from the repo.

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