How to run Mac command-line apps on Linux
If you’ve been waiting to run your favorite Mac command-line apps on Linux, you’ll be happy to know that progress is being made. Thanks to the Darling project, it’s now possible to run macOS command-line apps on Linux. Here’s how to get it working.
Why no GUI apps?
Darling as a project is working very hard to bring graphical Mac app support to Linux, however, since macOS is a different technology than Linux, it is difficult and time-consuming, and it will take some time to implement fully. So, for now, keep an eye on the Darling project, because GUI Mac app support for Linux will happen soon enough.
Install Darling on Linux
Before going into how to run command-line Mac applications on Linux, the Darling tool needs to be installed. Unfourutnaly, Darling must be built from source, as the project doesn’t distribute easy to install binary files for Ubuntu, Fedora, and others.
To start the installation, open up a terminal window by pressing Ctrl + Alt + T or Ctrl + Shift + T on the keyboard. Then, follow the command-line instructions outlined below to get Darling built on your Linux operating system.
Ubuntu
sudo apt-get install git cmake clang bison flex xz-utils libfuse-dev libudev-dev pkg-config libc6-dev:i386 linux-headers-generic gcc-multilib libcap2-bin libcairo2-dev libgl1-mesa-dev libtiff5-dev libfreetype6-dev libfreetype6-dev:i386 git libelf-dev libxml2-dev libegl1-mesa-dev libfontconfig1-dev libbsd-dev
Debian
sudo apt install gitcmake clang-6.0 bison flex xz-utils libfuse-dev libudev-dev pkg-config libc6-dev-i386 linux-headers-amd64 libcap2-bin git libcairo2-dev libgl1-mesa-dev libtiff5-dev libfreetype6-dev libxml2-dev libegl1-mesa-dev libfontconfig1-dev libbsd-dev
Arch Linux
sudo pacman -S --needed git make cmake clang flex bison icu fuse linux-headers gcc-multilib lib32-gcc-libs pkg-config fontconfig cairo libtiff python2 mesa llvm
Fedora
sudo dnf install git make cmake clang bison flex python2 glibc-devel.i686 fuse-devel systemd-devel kernel-devel elfutils-libelf-devel cairo-devel freetype-devel.{x86_64,i686} libjpeg-turbo-devel.{x86_64,i686} libtiff-devel.{x86_64,i686} fontconfig-devel.{x86_64,i686} libglvnd-devel.{x86_64,i686} mesa-libGL-devel.{x86_64,i686} mesa-libEGL-devel.{x86_64,i686} libxml2-devel libbsd-devel
OpenSUSE
Sadly, there are no dependencies listed on the Darling website for OpenSUSE. To get the software working, check the dependencies listed for Fedora and try them. Otherwise, consider switching to another Linux operating system on this list if you plan to use this software.
Building Darling
Now that the dependencies are installed, it’s time to download the source code from the internet with the git clone app.
git clone --recursive https://github.com/darlinghq/darling.git
Downloading the Darling source code from the internet takes a long time, and there are a lot of files to grab. Wait for the download to finish. Then, when the downloading is done, use the CD command to move into the source code folder.
cd darling
Next, use the mkdir command to create a “build” folder, and move into it with the CD command.
mkdir build
cd build
Using the cmake command, set up the build environment.
cmake ..
Compile the source code on your Linux PC using the make command.
make -j$(nproc)
The code compilation process will take quite a long time to complete. When the process is done, use the make install command to install the software.
sudo make install
Kernel module
Darling requires a kernel module to use Mac command-line software. To start the building process for the Darling kernel module, run the make command, with “lkm” at the end.
make lkm
Building the Linux kernel module for Darling will not take nearly as long as it does to install the software. Still, if you think it’s taking too long on your Linux PC, consider calling the make command with “$nproc” instead to make it finish faster.
make -j$(nproc) lkm
Once the Darling kernel module is compiled from the source code, you can install it on the system with lkm_install.
sudo make lkm_install
With the kernel module set up, everything is ready to go, and Darling can be used. However, keep in mind that on systems using SELinux, you may run into issues. For more information, read here.
Running Mac command-line apps on Linux
Software in Darling can be installed in two ways: with DMG files or PKG files. To start installing software, enter the Darling shell with the command below.
darling shell
Now that your Linux terminal has loaded up the Darling shell follow the step-by-step instructions below to get your command-line apps working in Darling.
Install from DMG
Step 1: Using the hdutil application in Darling, mount the DMG file to the system as a volume. Be sure to replace “app.dmg” and “/Volumes/app” with the name of your command-line application.
hdutil attach Downloads/app.dmg /Volumes/app
Step 2: Copy the app file into the “Applications” folder using the cp command.
cp -r /Volumes/app/app.app /Applications/
Install from PKG
Step 1: using the installer command, load the PKG file into the system. Be sure to replace “program.pkg” with the actual name of your PKG file.
installer -pkg program.pkg -target /