# Dual Wielding KiCAD stable and upstream on Arch

**URL:** <https://forum.1bitsquared.com/t/dual-wielding-kicad-stable-and-upstream-on-arch/166>\
**Category:** EDA-and-PCB\
**Created:** [November 14, 2020, 1:25pm UTC](https://forum.1bitsquared.com/t/dual-wielding-kicad-stable-and-upstream-on-arch/166 "2020-11-14T13:25:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![marble](https://forum.1bitsquared.com/user_avatar/forum.1bitsquared.com/marble/32/171_2.png) [@marble](https://forum.1bitsquared.com/u/marble)\
**Post date:** [November 14, 2020, 1:25pm UTC](https://forum.1bitsquared.com/t/dual-wielding-kicad-stable-and-upstream-on-arch/166/1 "2020-11-14T13:25:28Z")

</div>

First things first. Out of convenience I am using Manjaro Linux, but everything shown here should in general work for all systems with [`systemd-nspawn`](https://wiki.archlinux.org/index.php/Systemd-nspawn).

## 1. Installing KiCAD Stable

First install KiCAD as one would normally do.

```bash
$ sudo pacman -S kicad kicad-library kicad-library-3d

```

When starting eeschema/pcbnew for the first time, they asks you where to load the symbol and footprint library table from. Select default in both cases.

## 2. Setting up a nspawnd container

_on host_

```bash
# install pacstrap
sudo pacman -S arch-install-scripts

# create directory for container
mkdir -p containers/kicad_upstream

# install basic system
sudo pacstrap -c containers/kicad_upstream base base-devel yay

# chroot into container
sudo systemd-nspawn -directory containers/kicad_upstream

```

_in container_

```bash
# add a user and create home directory
useradd -m user

# set password for user
passwd user

# make user sudoer
groupadd sudo
usermod user -aG sudo
echo '%sudo ALL=(ALL) ALL' | tee -a /etc/sudoers.d/sudo

logout

```

## 3. Installing `kicad-git`

_on host_

```bash
# chroot into container as user
sudo systemd-nspawn --user=user -directory containers/kicad_upstream

```

_in container_

```bash
# update system
yay -Syyu

# start downloading, building and installing kicad from upstream
# this may take a long time
yay -S kicad-git

# clone the upstream libraries
mkdir -p repos/kicad
cd repos/kicad
git clone https://gitlab.com/kicad/libraries/kicad-footprints.git
git clone https://gitlab.com/kicad/libraries/kicad-symbols.git
git clone https://gitlab.com/kicad/libraries/kicad-packages3D.git

logout

```

## 4. Starting an Configuring Upstream KiCAD

To make the X environment available to the container, we have to [bind a modified xauth file](https://wiki.archlinux.org/index.php/Systemd-nspawn#Avoiding_xhost).

_on host_

```bash
XAUTH=/tmp/container_xauth
touch $XAUTH
xauth nextract - "$DISPLAY" | sed -e 's/^..../ffff/' | xauth -f "$XAUTH" nmerge -

```

KiCAD can then be started with  
_on host_

```bash
sudo systemd-nspawn --directory containers/kicad_upstream \
  --bind=/tmp/.X11-unix \
  --bind="$XAUTH" \
  --setenv DISPLAY="$DISPLAY" \
  --setenv XAUTHORITY="$XAUTH" \
  --user=user \
  /usr/bin/kicad

```

When running KiCAD for the first time, it prompts you about the configuration. Select the default.

Under Preferences \> Configure Paths set the following names to the paths of the repositories we just cloned.

| Name | Path |
| --- | --- |
| KICAD\_SYMBOL\_DIR | /home/user/repos/kicad/kicad-symbols |
| KISYS3DMOD | /home/user/repos/kicad/kicad-packages3D |
| KISYSMOD | /home/user/repos/kicad/kicad-footprints |

When starting eeschema/pcbnew for the first time, they asks you where to load the symbol and footprint library table from. Select “Custom global…” in both cases. Then browse to the corresponding repository and select `sym-lib-table` and `fp-lib-tabl` respectively.

Testing everything:

 ![](https://forum.1bitsquared.com/uploads/default/original/1X/d2529e126ea616d44fc22aa3d9d5eaf2d6980bd4.png)

 ![image](https://forum.1bitsquared.com/uploads/default/original/1X/f5537f561075e8a0950ac6f3e96ff71e72124c3c.png)

## 5. Keeping Up-to-Date

To update KiCAD repeate the installation from 3.

To update symbols and footprints, simply `git pull` in the repository.

---

<div class="post-metadata">

**Author:** ![esden](https://forum.1bitsquared.com/user_avatar/forum.1bitsquared.com/esden/32/144_2.png) [@esden](https://forum.1bitsquared.com/u/esden)\
**Post date:** [October 19, 2021, 10:15pm UTC](https://forum.1bitsquared.com/t/dual-wielding-kicad-stable-and-upstream-on-arch/166/2 "2021-10-19T22:15:41Z")

</div>

Thank you @marble for documenting this. It is very valuable to document manual building of packages like KiCad.

For those that don’t need to manually build KiCad. One of the community members created [`kicad-nightly`](https://aur.archlinux.org/packages/kicad-nightly/) and [`kicad-library-nightly`](https://aur.archlinux.org/packages/kicad-library-nightly/) AUR packages that can be installed side by side with the stable [`kicad`](https://archlinux.org/packages/community/x86_64/kicad/) package.

I hope this is useful. 🙂

Cheers,  
Piotr
