Skip to content

Installation on macOS with Apple Silicon chip from source code

Kimrli edited this page Jan 5, 2023 · 10 revisions

Tested on MacBook Pro with M1 chip and macOS Ventura.

Xcode

Xcode developer tools are needed for installing Homebrew and MacPort. Homebrew is needed for installing addtional libraries: jpeg-turbo, libtiff, gsl. MacPort is needed for installing clang15 which has OpenMP and other funcionality required by this project.

  1. Download and install latest Xcode from Apple developer website
    • Installing from Mac App Store is sometimes malfunctioning
  2. In shell (Terminal) run: xcode-select --install

More info here: website with instructions to install Xcode

Homebrew

Homebrew is package manager for macOS (needs Xcode).

  1. In shell (Terminal) run: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

More info here: website with instruction to install Homebrew

Install additional libraries

ColorScreen requires several packages: jpeg-turbo, libtiff, gsl

brew install jpeg-turbo libtiff gsl

On Mac with Apple Silicon chip, Homebrew installs packages into folder /opt/homebrew/Cellar/

Note: During configuration it can be handy to see mac’s hidden folders (⇧⌘.)

MacPorts

From MacPorts website download and open installer for macOS Ventura (needs Xcode).

Clang15

For running ColorScreen on Mac with Apple Silicon chip you need a different clang than default. You need a compiler that support OpenMP and -march=native. After installing MacPorts run in shell (Terminal): sudo port install clang-15

More info here: clang-15 MacPort website

Install Hugin

Hugin is software used by colorscreen-stitch for stitching multiple shots into one image. Download and install Hugin.

For using colorscreen-stitch you need to export cpfind command to your shell. You can do that temporarily from shell (Terminal): export PATH=/Applications/Hugin/tools_mac:$PATH. To do this permanently, you have to edit the shell profile.

For macOS Catalina and newer, the default shell is zsh. You can edit its config file (~/.zshrc or ~/.zsh_profile) by:

nano ~/.zshrc

This creates the file and opens it, if it wasn't created before, or opens the already existing one. Add an export line to the file:

export PATH=/Applications/Hugin/tools_mac:$PATH

Confirm the change by ⌃O, hit Return and close the editor by ⌃X. Then reopen shell (Terminal) to apply the changes. If everything went good, echo $PATH should write out list of paths that contains path to cpfind. You can also check it by typing cpfind in shell (Terminal). If cpfind was not found, you can try edit the ~/.zsh_profile, or you have bash (or other) shell and you need to apply this method on bash (or other) config files.

More info here: Setting PATH variable.

Install ColorScreen

  • Clone (or download) ColorScreen repository.
  • From shell (Terminal) in the folder with source code (git repository) run following:
    • replace <path where to build> with your custom destination, where you want to have ColorScreen
CC="/opt/local/bin/clang-mp-15" CXX="/opt/local/bin/clang++-mp-15" CXXFLAGS="-I/opt/homebrew/include" LDFLAGS="-L/opt/homebrew/lib" ./configure --prefix=<path where to build>
make install

To use colorscreen comfortably you can edit the ~/.zshrc file and add the following line:

export PATH=<path to colorscreen build>/bin/:$PATH

Use of ColorScreen Stitch

colorscreen-stitch output.tif parameters.par <xdim> <ydim> imag11.tif img12.tif ...

Install Multiblend

Alternative tool for stitching (isn't replacing Hugin yet!). To install Multiblend on Mac with Apple Silicon it is requried to get Intel based Homebrew and addtional packages. Instruction to install Intel Homebrew are here. Don't forget to edit the ~/.zshrc file to keep the path to Homebrew and its alias (axbrew) permanent.

After installing Intel Homebrew, install following packages: jpeg-turbo, libtiff, libjpeg, libpng:

axbrew install jpeg-turbo libjpeg libpng libtiff

From Multiblend website download source code for macOS (multiblend2.0rc5.tar.gz). Move the file to you desired destination and open it. After unpacking Multiblend move in shell (Terminal) to its src folder and from there run following in shell (Terminal):

gcc -I/usr/local/opt/jpeg-turbo/include -I/usr/local/homebrew/include -L/usr/local/opt/jpeg-turbo/lib  -L/usr/local/homebrew/lib -std=c++14 -msse4.1 -pthread -ffast-math -Ofast -o multiblend multiblend.cpp -target x86_64-apple-macos10.12 -lm -lpng -ltiff -ljpeg -lstdc++

To use multiblend comfortably you can add the following line to the ~/.zshrc file:

export PATH=<path to multiblend folder>/multiblend/src/:$PATH

Use of Multiblend

Run in shell (Terminal):

multiblend -o output_file.tif file1.tif file2.tif ...
multiblend --save-seams output_seams_file.png --cache-threshold=8G --tempdir=/tmp  --all-threads -o output_file.png file1.tif file2.tif ...

--save-seams shows aligning of image and --cache-threshold sets how much memory multiblend can use during computation.