Skip to content

Getting started on macOS

Jasmin B. Maglic edited this page Jul 11, 2023 · 14 revisions

MoloVol is distributed through .dmg installation files. These files are commonly used for installing applications on macOS. If you simply want to used the software "out-of-the-box" without needing access to the source code you can simply download the appropriate installation file for your platform. This article covers how to download the source code and compile it from scratch.

This article provides a detailed explanation of how to set up a command line development environment on macOS and compile MoloVol. You may want to do this if the installation file is not available for your platform or macOS version or if you would like to contribute to the project.

This guide has been tested with Catalina and Big Sur.

Requirements

You will need:

  • Xcode command line tools
  • Git
  • CMake
  • wxWidgets 3.1.5

Installing Xcode command line tools

You may need to first install Xcode command line tools, if you haven't already. This should be as easy as running the following command in the terminal.

$ xcode-select --install

Afterwards you should have clang installed. You can check whether clang is installed by requesting the version.

$ gcc -v
Configured with: ...
Apple clang version 12.0.5 (clang-1205.0.22.9)
Target: ...
Thread model: ...
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

Installing wxWidgets

To install wxWidgets visit https://www.wxwidgets.org and download the appropriate source files for macOS. Unzip the download file and place it in a directory of your choice, such as your user directory Users/myname/wx. Then enter that directory.

myname:~$ cd wx/wxWidgets-3.1.5

In order to compile wxWidgets and not risk overwriting it upon recompilation, create a new directory and enter it.

myname:wxWidgets-3.1.5$ mkdir build-debug
myname:wxWidgets-3.1.5$ cd build-debug

Afterwards run the configuration executable in the parent folder with the following flags:

  • Enable building for debugging.
  • Disable "shared" to obtain a static library.
  • Enable unicode support.
  • Minimum supported macOS version.
  • Build a universal library for 64 bit and ARM architectures. Needed for compiling the code on CPU chips with ARM architecture such as Apple M1.
myname:build-debug$ ../configure --enable-debug --disable-shared --enable-unicode --with-macosx-version-min=10.11 --enable-universal_binary=arm64,x86_64

Now you're ready to compile. Simply run:

myname:build-debug$ make

This step will take a while. Once compilation has finished, you can place the library files in your system's default library folder.

myname:build-debug$ make install

You can check whether your installation was successful by running the wx-config command.

$ wx-config --list
    Default config is osx_cocoa-unicode-static-3.1
  Default config will be used for output

Finally, you can remove the build files. They are no longer needed and take up disk space.

myname:build-debug$ make clean

If you ever wish to remove the installation, run the following command from your build folder.

myname:build-debug$ make uninstall

Downloading and compiling the source code

You will need to install Git if you haven't already. Visit https://git-scm.com. Once you have Git installed on your computer you can clone the repository to download all files to your local machine.

myname:~$ git clone https://github.com/jmaglic/MoloVol
myname:~$ cd MoloVol

Compilation of the application is done using CMake.

Creating an installation file (.dmg)

You can create your own .dmg file using CPack. First, create a build directory and configure CMake. Make sure to enable CMAKE_MACOSX_BUNDLE.

myname:build$ cmake .. -DCMAKE_OSX_ARCHITECTURES=arm64 -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_MACOSX_BUNDLE=ON -DMOLOVOL_ABS_RESOURCE_PATH=ON

Afterwards, create the .dmg file by running CPack.

myname:build$ cpack -G DragNDrop

To open the newly created file from the command line use the open command.

myname:build$ open MoloVol_version_Darwin.dmg