Setting Default Programs on Mac
2023-07-30

Many users often inquire about how to set Picview as the default program for opening images. Here, we will introduce two methods: one through the interface, which can only set one format at a time, making it cumbersome to set multiple formats at once. ... The other method involves using the command line, which allows you to set multiple formats for default programs at once, making it more flexible.

# Interface Method (Setting One Format at a Time)

Move the mouse cursor over the image file you want to modify the default opening program for, for example, "example.jpg". Right-click the mouse, and in the popup menu, click "Get Info," as shown in the following image. Right-click menu.png

In the information window, under "Open with," select Picview.app, then click "Change All," and close the information window. This way, the format will be set as the default to open with Picview, as shown in the following image. Info window.png

# Command Line Method (Setting Multiple Formats at Once)

This method requires using the command line tool. Follow these steps:

  • Open the Terminal, which is the command line tool.
  • Install the package manager Homebrew (opens new window). Copy the following line of code to the Terminal, and press Enter to execute. (Skip this step if you have already installed Homebrew)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  • Installduti (opens new window),a command line tool for modifying default programs. Copy the following line of code to the Terminal, and press Enter to execute. (Skip this step if you have already installed duti)
brew install duti
  • Click the configuration file: duti_picview.config, to download the execution parameter configuration file for duti.
  • Execute the duti command to modify the default opening program for the formats you want Picview to be associated with. Copy the following line of code to the Terminal, replacing "<.../duti_picview.config>" with the full path name of duti_picview.config, and press Enter. Alternatively, you can directly input "duti " (note the space after "duti") in the Terminal, then drag and drop the downloaded duti_picview.config to the Terminal, and press Enter.
duti <.../duti_picview.config>
  • The setup is complete.

# duti_picview.config File Explanation

The duti_picview.config file is shown below and can be modified according to your specific needs.

# Each line represents a format setting. The last line of this file must be empty. Lines starting with # are comment lines.
# Edited on 2023/07/30
#
# Image formats
#
# Format: .dng
com.chitaner.Picview    com.adobe.raw-image  all
#
# Format: .psd (This format is disabled by default. Remove the "#" to enable it)
# 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
#
# If you want to add other formats, copy a line, and modify "public.png" to the UTI of the corresponding format. You can get the UTI using the mdls command.
#


# Reference Commands

  1. View the default opening program for a specific format:
duti -x sag
  1. View the UTI of a specific file:
mdls test.txt

# Reference Articles