How to install Photoview on FreeBSD


Recently I was getting back into photography and as a result I was looking for a place to host my photos and share them with my friends without making them public to the whole world. Additionally I would like to see the photo’s EXIF information and other metadata.

I do have an old flickr account and so I’ve tried that first but I was quite disappointed by the antiquated interface of adding and editing photos, including its permission settings for viewing.

Next I was looking for self-hosted photo gallery options, ideally with few external dependencies and written in a programming language like Go or Elixir.

There is a great wiki for looking up self-hosted software options which has photo galleries as one of its categegories.

I’ve checked a few of them out and decided to give Photoprism and Photoview a shot since they’re both written in Go.

Photoprism, despite having a 3rd party portfile for FreeBSD was impossible for me to install as the portfile does not appear to be well maintained and failed at a critical build stage with no apparent workarounds.

Photoview had to be installed manually on FreeBSD and the installation process also had some things I needed to figure out to get it running. There is a manual installation page in the documentation but not all steps lined up.

This is why I’ve decided to compile all the required steps to install Photoview on FreeBSD for the next person attemting to give it a go – so here we go.

Installation Steps

First step is of course to clone the repository:

git clone

Next I had to figure out the correct pkgs as some did not correspond 1:1 with their linux versions:

  • libheif
  • libde265
  • go
  • pkgconfig
  • dlib-cpp
  • lapack
  • blas
  • cblas
  • node16 (higher version would probably work as well)
  • npm-node16

To build the UI part of photoview I had to run:

cd ui
npm install

Then before building the frontend I had to edit the vite.config.js file and add the folloing lines to the top level of the defineConfig section.

build: {
chunkSizeWarningLimit: 1600,

Mine now looks like this:

import { defineConfig } from 'vite'
import svgr from 'vite-plugin-svgr'
import react from '@vitejs/plugin-react'

export default defineConfig({
  plugins: [react(), svgr()],
  build: {
    chunkSizeWarningLimit: 1600,

After that the frontend part of photoview should build by running:

npm run build

When this was successful, change to the api directory.

The official documentation says that a simple

go build -v -o photoview .

should be sufficient but on FreeBSD it fails to find some of the dependencies which lead me to this Github issue which had the solution in the comments.

Runing this command did the trick for me:

env CGO_CFLAGS="-I/usr/local/include/" CGO_CXXFLAGS="-I/usr/local/include" CGO_LDFLAGS="-L/usr/local/lib" go build -v -o photoview .

Lastly the documentation tells you to copy the build results to a new location. Instead of building into a folder called “build”, on my machine the frontend was built into a directory called “dist”.

Therefore these are the commands I’ve used to put everything together:

sudo mkdir -p /usr/local/www/photoview
sudo chown www:www /usr/local/www/photoview
cp -R api/photoview /usr/local/www/photoview
cp -R api/data /usr/local/www/photoview/data
cp -R ui/dist /usr/local/www/photoview/ui
cp api/example.env /usr/local/www/photoview/.env

I’ve edited the .env file and put in my database connection details and set those to options:


Then I made a folder for the photos to go. To upload new photos, create a subfolder and put your photos inside. A new album will be automatically created for that subfolder.

mkdir /var/db/photos/
sudo chown www:www /var/db/photos/

Last step, run the thing:

cd /usr/local/www/photoview

This is now in a local only jail, meaning that it has no LAN or WAN address and instead uses a 127.0.1.x IP. On my web jail I configured a new vhost in nginx to proxy requests to the photoview jail.

Right now I have not made an RC script for it but when I do I will amend this post accordingly.

That’s it for now – I hope it helps another FreeBSD sould along the way. Right now Photoview does pretty much what I wanted. It’s quite simple but not too simple. If I had failed installing and running it, I would’ve went with Lychee otherwise.

Leave a Reply

Your email address will not be published. Required fields are marked *