I installed and run OpenBSD and I wanted to install git but there were no repositories for OpenBSD. What should I do if I want to install some programs with pkg_add?

  • 2
    The FAQ suggests setting the PKG_PATH environment variable.
    – kdhp
    Apr 23, 2016 at 21:50

2 Answers 2


On 6.0 and below, add a mirror to the file /etc/pkg.conf:

installpath = http://ftp.eu.openbsd.org/pub/OpenBSD/5.9/packages/amd64/

On 6.1 and later, use the file /etc/installurl:

  • 1
    I did but when I try to to add with pkg_add it says the repo is empty. Apr 24, 2016 at 4:33
  • 2
    Can you run unset PKG_PATH && pkg_info -Q git as root? Apr 24, 2016 at 17:31
  • 2
    Run this command: ftp http://ftp.eu.openbsd.org/pub/OpenBSD/5.9/packages/amd64/SHA256 . Works? Apr 24, 2016 at 23:39
  • 1
    Show me the output of :ifconfig | grep '^[a-z]' | cut -d' ' -f1 Apr 25, 2016 at 0:33
  • 2
    Run as root: echo dhcp > /etc/hostname.em0 and reboot the system. Apr 25, 2016 at 0:45

You have to add one or more mirrors to your /etc/pkg.conf. You can add multiple mirrors by using the += notation.

installpath = http://ftp5.eu.openbsd.org/ftp/pub/OpenBSD/%c/packages/%a/
installpath += http://ftp2.eu.openbsd.org/pub/OpenBSD/%c/packages/%a/

%c and %a are variables that get replaced by the release and the architecture of your installation. That way you don't have to upgrade your config file after every release.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.