rawtherapee-cli Configuration Paths and Files Mac OS

I am using rawtherapee-cli dev version (RawTherapee, version 5.8-3085-g59a36d8f8, command line).

I created a script to convert the .CR2 raw files produced by my Canon T7i to TIF files and eventually to gimp. It does some file specific operations at the beginning, then loops around and finds all the .CR2 files in the current directory then calls rawtherapee-cli (RawTherapee, version 5.8-3085-g59a36d8f8, command line) latest development version built on my macBook Pro running Monterey version 12.2.1 on a Macbook Pro 14" 2021.

Problem is when I run it, I get these errors:

  • Error: the user’s processing profile path doesn’t point to a directory or doesn’t exist!
  • The default profile for raw photos could not be found or is not set. Please check your profiles’ directory, it may be missing or damaged. “${G}/Auto-Matched Curve - ISO Low” will be used instead.
  • The bundled profile “${G}/Auto-Matched Curve - ISO Low” could not be found! Your installation could be damaged. Default internal values will be used instead.
  • Error: “~/Library/Application\ Support/RawTherapee5-dev/config/profiles/” not found.

Seems like it’s looking for config files and it can’t find then. I created a folder in ~/Library/Application Support/RawTherapee5-dev and copied the contents of RawTherapee/rtdata/profiles there.

Below is the script, any thoughts on how to configure the command line?

\#!/bin/sh

\#Check to see if output directories exist, if not create them
\#Make sure the directories are empty

tifFolder=./TifFiles
gimpFolder=./GimpFiles
pngFolder=./PngFiles

mkdir -p \$tifFolder
rm \$tifFolder/*

mkdir -p \$gimpFolder
rm \$gimpFolder/*

mkdir -p $pngFolder
rm $pngFolder/*

for f in \*.CR2;
do
    fileName="\${f%%.*}" ;
    pp3File='~/Library/Application\ Support/RawTherapee5-dev/config/profiles/CanonDefault.pp3'
    cfgPath='~/Library/Application\ Support/RawTherapee5-dev/config/profiles/'
    cr2Filename='./'\$fileName'.CR2'
    tifFilename=\$tifFolder'/'\$(echo \$fileName | sed 's/ /\\ /g')'.tif' ;
    pngFilename=\$pngFolder'/'$(echo \$fileName | sed 's/ /\\ /g')'.png' ;
    \# First convert CR2 file to tiff
    rtCmd=(rawtherapee-cli -a -t -Y -p "$cfgPath" -c "$cr2Filename")
    "${rtCmd[@]}"
done

Regards,

Paul

@paulm888

I’m assuming for the moment that the escaping of the $ and # I see are due to copy/pasting here at pixels and not actually part of the code.

About your main issue. There are 2 issues here:

  1. The tilde (~) is not expanded when used in a variable. Use $HOME instead. ~/Library/Application… vs $HOME/Library/Application…
  2. Some of your variables are declared using single quotes. Single quotes inhibit expanding of variables, use double quotes instead.

One other thing that might be of influence: You use bash internals (${f%%.*} being one of them), but your hash bang is set to sh. I’m not sure how MacOS is set up, but sh might not be pointing to bash or might point to a restricted version of bash. If this is the case using bash internals might not work. Just to make sure and avoid this possible issue change this:

#!/bin/sh

to

#!/bin/bash

There are other things that could be done better or more elegant, but I’ll let you play with and work on the script yourself.