macOS and Linux share a common heritage. Unfortunately, that does not mean applications can smoothly transition between the operating systems. To run Mac apps on Linux, you’ll need some sort of virtual machine or translation layer.
Run a macOS Virtual Machine (All Apps)
The most reliable way to run Mac apps on Linux is through a virtual machine. With a free, open-source hypervisor application like VirtualBox, you can run macOS on a virtual device on your Linux machine. A properly-installed virtualized macOS environment will run all macOS apps without issue.
Virtualizing a desktop like this does require significant RAM, so it may not run smoothly on low-resource devices. For machines with the technical specs, virtualizing an operating systems through a VirtualBox virtual machine is the best option.
Using the Darling Translation Layer (CLI Only)
You can also run a translation layer called Darling. This works like WINE, which creates a Windows-to-Linux translation environment that allows you to run some Windows applications on Linux systems. Darling tries to accomplish the same goal between macOS and Linux. Because macOS and Linux both share the same UNIX-style base, Darling is less resource-intensive than WINE, producing better results in more circumstances.
For the time being, Darling can only work with very simple GUI apps and several command-line apps. While GUI app support is a goal for the project, the feature hasn’t yet been implemented. Basically, you can run a macOS shell in Terminal reliably and may or may not be able to run other apps effectively.
It also contains an enormous amount of code, requiring about 12 gigabytes of disk space after building. It’s essentially duplicating the functionality of the macOS operating system. So, if you worry about remote executables corrupting your system, you might want to avoid a package of this size.
Building and Installing Darling
1. Follow the installation instructions to download the correct dependencies for your Linux distro from the Darling Install page. Depending on your distro, you may need to run a lengthy command. For example, for Ubuntu, run the following Terminal command to download Darling’s dependencies:
sudo apt-get install 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
2. Clone Darling’s git depository to your local machine:
git clone –recursive https://github.com/darlinghq/darling.git
3. Change the directory into the Darling clone:
4. Make and build the darling directory:
mkdir build && cd build
5. Configure the build with cmake:
6. Build Darling:
The build process may take longer than one hour, depending on your machine’s resources.
7. Install Darling:
sudo make install
8. Build Darling’s kernal module darling_mach:
9. Install darling_mach:
sudo make lkm_install
Running macOS Applications on Linux with Darling
To access the darling subsystem, run darling shell. This uses the darling command prefix to launch a macOS shell environment:
Once inside the darling shell, you can run commands as if you were on a macOS system. All program installation happens within the darling shell. Running the commands without connecting to Darling won’t work.
To attempt to run a macOS program, first download the appropriate files. You’ll want to obtain a .dmg or .pkg on your Linux machine. If you want to run an app from the Mac App Store, copy the .app file to “/Applications/” on your Linux machine then launching it through Darling’s shell commands.
Install from DMG
To install a program from a .dmg, mount it with hdiutil within Darling:
hdiutil attach AppName.dmg
Copy the application to your local storage:
cp -r /Volumes/AppName/AppName.app /Applications/
Run through Darling:
Install from PKG
To install a program from pkg, use installer within Darling:
installer -pkg foo.pkg -target /
Uniquely to Darling, .pkgs can be uninstalled using the uninstaller companion command.
Once installed, run through Darling:
Darling works well with command line programs, but will hopefully eventually support GUI applications.