To set multiple image formats to open by default with Picview as the default viewer via the command line, follow these steps:

  • Open the Terminal application.
  • Install the Homebrew package manager. Copy and paste the following command into Terminal, then press Enter. (If Homebrew is already installed, skip this step. Installation may take some time.)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  • Install the duti tool, a command-line utility for modifying default file open applications. Copy and paste the following command into Terminal, then press Enter. (If duti is already installed, skip this step.)
brew install duti
  • Click on the configuration file: duti_picview.config, download it, or save it as the execution parameter configuration file for duti, and name it: duti_picview.config.
  • Run the duti command to modify the default applications for the formats you want to associate with Picview. Copy and paste the following command into Terminal, replacing <.../duti_picview.config> with the full path to the duti_picview.config file, then press Enter. Alternatively, type “duti " (note the space after duti) in Terminal and drag the downloaded duti_picview.config file into the Terminal window, then press Enter.
duti <.../duti_picview.config>
  • Setup complete.

Explanation of the duti_picview.config Configuration File

The duti_picview.config file is as follows and can be modified according to your needs.

# Each line represents the settings for one format. The last line of this file must be blank. Lines starting with "#" are comments.  
# Edited on 2023/07/30  
#  
# Image Formats  
#  
# Format: .dng  
com.chitaner.Picview    com.adobe.raw-image  all  
#  
# Format: .psd (Disabled by default. Remove "#" to enable.)  
# com.chitaner.Picview    com.adobe.photoshop-image  all  
#  
# Format: .cr2  
com.chitaner.Picview    com.canon.cr2-raw-image  all  
#  
# Format: .ico  
com.chitaner.Picview    com.microsoft.ico  all  
#  
# Format: .tga  
com.chitaner.Picview    com.truevision.tga-image  all  
#  
# Format: .raf  
com.chitaner.Picview    com.fuji.raw-image  all  
#  
# Format: .exr  
com.chitaner.Picview    com.ilm.openexr-image  all  
#  
# Format: .tiff  
com.chitaner.Picview    public.tiff  all  
#  
# Format: .pict  
com.chitaner.Picview    com.apple.pict  all  
#  
# Format: .nef  
com.chitaner.Picview    com.nikon.raw-image  all  
#  
# Format: .jpeg  
com.chitaner.Picview    public.jpeg  all  
#  
# Format: .dds  
com.chitaner.Picview    com.microsoft.dds  all  
#  
# Format: .pbm  
com.chitaner.Picview    public.pbm  all  
#  
# Format: .heif  
com.chitaner.Picview    public.heif  all  
#  
# Format: .jp2  
com.chitaner.Picview    public.jpeg-2000  all  
#  
# Format: .pic  
com.chitaner.Picview    public.radiance  all  
#  
# Format: .sgi  
com.chitaner.Picview    com.sgi.sgi-image  all  
#  
# Format: .gif  
com.chitaner.Picview    com.compuserve.gif  all  
#  
# Format: .nrw  
com.chitaner.Picview    com.nikon.nrw-raw-image  all  
#  
# Format: .heic  
com.chitaner.Picview    public.heic  all  
#  
# Format: .bmp  
com.chitaner.Picview    com.microsoft.bmp  all  
#  
# Format: .pbm  
com.chitaner.Picview    net.sourceforge.netpbm.netpbm-image  all  
#  
# Format: .rw2  
com.chitaner.Picview    com.panasonic.rw2-raw-image  all  
#  
# Format: .png  
com.chitaner.Picview    public.png  all  
#  
# Format: .pef  
com.chitaner.Picview    com.pentax.raw-image  all  
#  
# Format: .orf  
com.chitaner.Picview    com.olympus.raw-image  all  
#  
# Format: .webp  
com.chitaner.Picview    public.webp  all  
#  
# Format: .svg  
com.chitaner.Picview    public.svg-image  all  
#  
# To add additional formats, copy a line, and replace "public.png" with the corresponding UTI for the format. Use the mdls command to obtain the UTI.  
#

Reference Commands

  1. Check the default application for a specific format:
duti -x sag
  1. Check the UTI of a specific file:
mdls test.txt

Reference Articles