Home Apple Run MacOS Software On Linux Using Darling
Run MacOS Software On Linux Using Darling

Run MacOS Software On Linux Using Darling

By sk
8082 Views

We have Wine, a free and open-source compatibility layer that helps us to install and run applications and games developed for Windows on Linux and Unix-like operating systems. We also have an emulator named Dosbox to run good-old MS-DOS games and defunct C++ compilers like Turbo C++ in Linux. What about macOS software? Have you ever wondered how to run applications specifically for mac under Linux? That's what we are going to do now. This guide explains how to run macOS software on Linux operating systems using Darling runtime environment.

Darling is a translation layer that allows us to run macOS applications on Linux. It emulates a complete Darwin environment, including Mach, dyld, launchd and everything you'd expect. It lets you to instantly switch to a Bash shell and start running the applications built for macOS in your Linux system. Sounds cool, yeah?

Darling is very similar to Wine. Wine allows you to run Windows apps on Linux. Darling lets you to run macOS software Linux.

Good thing is Darling doesn't violate Apple's EULA. Because It only uses the parts of Darwin version that are released as fully free software.

The name "Darling" comes from the combination of “Darwin” and “Linux”. As you probably know, Darwin is the core operating system macOS and iOS are based on.

Darling is free and open-source software released under GPLv3.

Install Darling on Ubuntu Linux

Currently, the Darling developers have provided pre-compiled DEB packages only. Go to the releases page and download the DEB packages are provided for darling and darling-dkms (the kernel module).

$ sudo gdebi darling-dkms_0.1.20200331.testing_amd64.deb

Sample output:

Reading package lists... Done
Building dependency tree        
Reading state information... Done
Reading state information... Done

Kernel module for Darling
Do you want to install the software package? [y/N]:y
/usr/bin/gdebi:113: FutureWarning: Possible nested set at position 1
  c = findall("[[(](\S+)/\S+[])]", msg)[0].lower()
Selecting previously unselected package darling-dkms.
(Reading database ... 269719 files and directories currently installed.)
Preparing to unpack darling-dkms_0.1.20200331.testing_amd64.deb ...
Unpacking darling-dkms (0.1.20200331~testing) ...
Setting up darling-dkms (0.1.20200331~testing) ...
>>> DKMS: Module add, build, and install

Creating symlink /var/lib/dkms/darling-mach/0.1/source ->
                 /usr/src/darling-mach-0.1

DKMS: add completed.

Kernel preparation unnecessary for this kernel.  Skipping...

Building module:
cleaning build area....
'make' -C lkm/ MIGDIR=/usr/src/darling-mach-0.1/miggen MIGDIR_REL=../miggen KERNELVERSION=5.4.0-48-generic...........................................
cleaning build area...

DKMS: build completed.

darling-mach.ko:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/5.4.0-48-generic/updates/dkms/

depmod............

DKMS: install completed.

After installing darling-dkms package, install darling using command:

$ sudo gdebi darling_0.1.20200331.testing_amd64.deb 

Sample output:

Reading package lists... Done
Building dependency tree        
Reading state information... Done
Reading state information... Done
Requires the installation of the following packages: libc6-i386 

Darling
 macOS emulation layer for Linux
Do you want to install the software package? [y/N]:y
/usr/bin/gdebi:113: FutureWarning: Possible nested set at position 1
  c = findall("[[(](\S+)/\S+[])]", msg)[0].lower()
Get:1 http://ny-mirrors.evowise.com/ubuntu focal-updates/main amd64 libc6-i386 amd64 2.31-0ubuntu9.1 [2721 kB]
Fetched 2721 kB in 0s (0 B/s)                                                              
Selecting previously unselected package libc6-i386.
(Reading database ... 274071 files and directories currently installed.)
Preparing to unpack .../libc6-i386_2.31-0ubuntu9.1_amd64.deb ...
Unpacking libc6-i386 (2.31-0ubuntu9.1) ...
Setting up libc6-i386 (2.31-0ubuntu9.1) ...
Processing triggers for libc-bin (2.31-0ubuntu9.1) ...
Selecting previously unselected package darling.
(Reading database ... 274374 files and directories currently installed.)
Preparing to unpack darling_0.1.20200331.testing_amd64.deb ...
Unpacking darling (0.1.20200331~testing) ...
Setting up darling (0.1.20200331~testing) ...
>>> Shutting down old instances of Darling
Seeing if Darling is currently running
No instances running now

The reason I prefer to install .deb packages with Gdebi is it will automatically resolve the required dependencies and install them for me. If you prefer to use dpkg package manager, you need to first install the Darling DEB packages and then install the missing dependencies like below.

$ sudo gdebi darling-dkms_0.1.20200331.testing_amd64.deb
$ sudo gdebi darling_0.1.20200331.testing_amd64.deb
$ sudo apt install -f

On other Linux distributions, you may need to manually compile and install Darling from the source as described here.

Run MacOS Software On Linux Using Darling

The developers of Darling are planning to build a nice and user-friendly GUI for interacting with Darling. But for now, we can interact with Darling via command line only.

To enter into Darling shell, simply run the following command as normal user:

$ darling shell
Loaded the kernel module
Setting up a new Darling prefix at /home/sk/.darling
Bootstrapping the container with launchd...
Darling [/Volumes/SystemRoot/home/sk/Downloads/darling]$

This command will start a virtual root directory (i.e. container) or connect to an already running container and spawn the shell inside.

Launch Darling shell
Launch Darling shell

It will also automatically load the kernel module and initialize the prefix contents if required. The Darling prefixes are called DPREFIXes, which are very similar to WINEPREFIXes. A prefix is nothing but a virtual “chroot” environment with an macOS-like filesystem structure, where we can install software safely.

The current shell running inside the container is Bash and it's version is 3.2.

$ bash --version
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin14)
Copyright (C) 2007 Free Software Foundation, Inc.

Now, we are inside the emulated macOS-like environment. Since macOS is an Unix variant, many Linux and Unix commands should work in the Darling shell.

For example, print operating system's name using command:

$ uname
Darwin

List the contents of root (/) directory:

$ ls -l /

Sample output:

total 120
drwxr-xr-x    2 sk  sk  4096 Oct  5 09:54 Applications
drwxr-xr-x    1 sk  sk  4096 Oct  5 07:19 Library
drwxr-xr-x    1 sk  sk  4096 Oct  5 07:19 System
drwxrwxr-x    4 sk  sk  4096 Oct  5 09:54 Users
drwxr-xr-x    1 sk  sk  4096 Oct  5 09:54 Volumes
drwxr-xr-x    1 sk  sk  4096 Oct  5 07:20 bin
lrwxrwxrwx    1 sk  sk    23 Mar 31  2020 dev -> /Volumes/SystemRoot/dev
lrwxrwxrwx    1 sk  sk    11 Mar 31  2020 etc -> private/etc
drwxr-xr-x    1 sk  sk  4096 Oct  5 09:54 private
dr-xr-xr-x  292 sk  sk     0 Oct  5 09:54 proc
drwxr-xr-x    1 sk  sk  4096 Oct  5 07:20 sbin
lrwxrwxrwx    1 sk  sk    11 Mar 31  2020 tmp -> private/tmp
drwxr-xr-x    1 sk  sk  4096 Oct  5 09:54 usr
drwxr-xr-x    5 sk  sk  4096 Oct  5 09:54 var

Similarly, use any macOS-specific commands to explore the emulated environment.

Darling filesystem layout

If you are already familiar with macOS filesystem, you will notice that the filesystem layout inside the container is similar to that of macOS, including the the top level directories such as /Applications/Users, and /System etc.

The original Linux filesystem is visible as a separate partition that's mounted on /Volumes/SystemRoot. You can verify it by running any Linux command with full path name like below:

$ /Volumes/SystemRoot/bin/uname 
Linux

As you see in the above output, It lists my actual host system's name, not the container's name. If you don't specify the pull path (i.e. /Volumes/SystemRoot/bin/uname), it will list the container's name.

When running macOS programs under Darling, you may want them to access the files in your home folder. To make this convenient, there is a LinuxHome symlink in your Darling home folder that points to your Linux home folder, as seen from inside the container. Additionally, standard directories such as Downloads in your Darling home folder are symlinked to the corresponding folders in your Linux home folder.

List of things you can currently do with Darling

Please note that most GUI applications will not work at the moment. Currently, you can only run some simple graphical applications and many command line programs. Don't get disappointed. The GUI applications doesn't work out of the box just yet. The developers are working on this to fully integrate apps running under Darling into the Linux desktop just like the native apps. They even have plans for supporting iOS apps in the long run.

Here is the list of commands that you can currently run with Darling.

Print the Mac OS X operating system details using command:

$ sw_vers

This command will display the Mac OS name, product version and build version:

ProductName:    Mac OS X
ProductVersion: 10.14
BuildVersion:   Darling

Print something cool on the standard output using echo command:

$ echo Welcome To OSTechNix
Welcome To OSTechNix

Display the name of the operating system:

$ uname 
Darwin

Explore the Darling filesystem:

$ ls -l /
$ ls -l /Library/    
total 56
drwxr-xr-x  1 sk  sk  4096 Oct  5 07:19 Developer
drwxr-xr-x  1 sk  sk  4096 Oct  5 07:20 Documentation
drwxr-xr-x  1 sk  sk  4096 Mar 31  2020 LaunchAgents
drwxr-xr-x  1 sk  sk  4096 Mar 31  2020 LaunchDaemons
drwxr-xr-x  1 sk  sk  4096 Oct  5 07:19 Python
$ ls -l /Volumes/   
total 8
lrwxrwxrwx   1 sk  sk     1 Mar 31  2020 DarlingEmulatedDrive -> /
drwxr-xr-x  25 sk  sk  4096 Oct  5 07:19 SystemRoot
$ ls -l /System/Library/
total 120
drwxr-xr-x  1 sk  sk  4096 Oct  5 07:19 Components
drwxr-xr-x  1 sk  sk  4096 Oct  5 07:20 CoreServices
drwxr-xr-x  1 sk  sk  4096 Oct  5 07:20 Frameworks
drwxr-xr-x  1 sk  sk  4096 Oct  5 07:20 LaunchDaemons
drwxr-xr-x  1 sk  sk  4096 Oct  5 07:19 OpenSSL
drwxr-xr-x  1 sk  sk  4096 Oct  5 07:19 Perl
drwxr-xr-x  1 sk  sk  4096 Oct  5 07:19 PrivateFrameworks
drwxr-xr-x  1 sk  sk  4096 Mar 31  2020 Security
drwxr-xr-x  1 sk  sk  4096 Oct  5 07:19 User Template

Display currently running processes:

$ ps aux
USER   PID  %CPU %MEM      VSZ    RSS   TT  STAT STARTED      TIME COMMAND
sk     127   0.0  0.1  4226308   8760   ??  R     1Jan70   0:00.02 nps aux 
sk      19   0.0  0.1  4219692   5944   ??  R     1Jan70   0:00.03 o/usr/libexec/shellspawn 
sk      20   0.0  0.1  4342428   9236   ??  R     1Jan70   0:00.06 s/usr/sbin/syslogd 
sk      21   0.0  0.1  4224292   8956   ??  R     1Jan70   0:00.03 s/usr/sbin/memberd -x 
sk      22   0.0  0.2  4355536  15544   ??  R     1Jan70   0:00.06 /usr/sbin/iokitd 
sk      23   0.0  0.1  4423744   9400   ??  R     1Jan70   0:00.14 //usr/sbin/notifyd 
sk      33   0.0  0.1  4480688   8576   ??  R     1Jan70   0:00.06 oaslmanager 
sk      39   0.0  0.0  4227884   3952   ??  RN    1Jan70   0:00.01 s/usr/libexec/shellspawn 
sk      40   0.0  0.1  4226028  10084   ??  R     1Jan70   0:00.38 e/bin/bash --login 
sk       1   0.0  0.1  4260676   9536   ??  R     1Jan70   0:01.06 n/sbin/launchd 

Check the mounts:

$ column -t /proc/self/mounts 

Read manual pages:

$ man uname

You can do more. Everything is given under the section titled "What to try" in the official documentation linked at the end.

Terminate Darling

One you are done with exploring the Mac OS, simply exit from the Darling shell and shutdown the container using commands:

$ exit
$ darling shutdown

You will not see any notification when the container is being shutdown. Run that command again and you will see the following output:

Darling container is not running

Conclusion

Unlike Wine, Darling is not a mature project. Using Wine, you can run so many windows applications, even some high-end games, under Linux. Unfortunately, Darling do not help much. It can only run a handful of command line programs at the moment. It is still in alpha-stage. You can use it for basic learning and testing purposes.

Give it a try and let us know how'd go in the comment section below.

Resources:

Featured image by ErfourisStudio from Pixabay.

You May Also Like

1 comment

W October 7, 2020 - 4:41 pm

I wish this tool was called Cider.

Reply

Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More