Darwin/macOS emulation layer for Linux
Go to file
2016-02-26 22:59:34 +01:00
basic-headers Build fixes, missing files 2016-02-24 23:13:42 +01:00
cmake Add expat and sqlite, Python 2.6 now also builds (but there are issues to resolve) 2016-02-20 00:46:18 +01:00
compiler-include Initial commit, some libc modules building 2014-12-04 01:11:22 +01:00
etc Moving towards a single (original) MacTypes.h 2016-02-24 23:04:42 +01:00
kernel-include Preparations for building launchd 2015-12-12 14:45:56 +01:00
misc Cleanup benchmarks, misc and tools directories 2016-02-26 22:59:34 +01:00
platform-include Added shell_cmds submodule, building some executables from it. 2015-12-21 00:56:09 +01:00
src darling script: fix check_prefix 2016-02-26 21:21:07 +01:00
tests Removing Git submodules 2014-01-06 20:47:37 +01:00
tools Cleanup benchmarks, misc and tools directories 2016-02-26 22:59:34 +01:00
.gdbinit Loads of work on dyld and BSD functions 2012-08-15 12:17:58 +02:00
.gitignore Updated .gitignore 2015-11-03 13:07:47 +01:00
.gitmodules Moving towards a single (original) MacTypes.h 2016-02-24 23:04:42 +01:00
CMakeLists.txt Lowering the minimum required version of CMake 2016-02-26 10:59:24 +01:00
darwin.map Restructured source tree to prepare for merge with the "darling" repo 2015-10-24 22:29:54 +02:00
LICENSE Loads of work, libmacarchive added, copyright headers... 2012-10-22 19:02:06 +02:00
README.md Fix build command typo 2016-02-24 22:12:29 -05:00
README.md.old Moving README.md away, because this is an experimental branch 2015-10-25 19:37:16 +01:00
Toolchain-x86_64.cmake Made the build more Debian-friendly 2016-02-10 22:47:08 +01:00
Toolchain-x86.cmake Made the build more Debian-friendly 2016-02-10 22:47:08 +01:00

Darling

Darling is a runtime environment for OS X applications.

Please note that no GUI applications are supported at the moment.

Download

Darling uses many Git submodules, so a plain clone will not do.

git clone https://github.com/darlinghq/darling.git
cd darling
git submodule init
git submodule update

Updating sources:

git pull
git submodule init
git submodule update

Build Instructions

For running x86-64 OS X binaries

cd darling
mkdir -p build/x86-64
cd build/x86-64
cmake ../.. -DCMAKE_TOOLCHAIN_FILE=../../Toolchain-x86_64.cmake
make
make install

# Now we go into src/lkm to build the kernel module
cd ../../src/lkm
make
make install

Required dependencies on Debian (stable): cmake clang bison flex linux-headers-amd64 xz-utils libfuse-dev libxml2-dev libicu-dev libssl-dev libbz2-dev zlib1g-dev libudev-dev

For running i386 OS X binaries

cd darling
mkdir -p build/i386
cd build/i386
cmake ../.. -DCMAKE_TOOLCHAIN_FILE=../../Toolchain-x86.cmake
make
make install

Required additional dependencies on Debian (stable): libc6-dev-i386 libudev-dev:i386 lib32stdc++-4.9-dev

Loading the kernel module:

modprobe darling-mach

# ATTENTION: The kernel module is likely unstable,
# full of vulnerabilities, etc.
# You SHOULD restrict access to /dev/mach to trusted
# users only and be prepared to the eventuality of
# kernel hangups (and related data loss).

chmod a+rw /dev/mach

Optional Features

Optionally, you can enable audio support with the -DFRAMEWORK_COREAUDIO=On. This is still under development, so it probably only makes sense if you want to contribute. This switch enables both ALSA and PulseAudio support by default, you can disable either of them with -DENABLE_ALSA=OFF or -DENABLE_PULSEAUDIO=OFF respectively.

Required dependencies on Debian (stable):

  • x86-64: libpulse-dev libasound2-dev libavresample-dev libavformat-dev libavcodec-dev
  • i386: libpulse-dev:i386 libasound2-dev:i386 libavresample-dev:i386 libavformat-dev:i386 libavcodec-dev:i386

Note that most of the above -dev packages conflict between x86-64 and i386, so if you build for both platforms, you have to reinstall the right -dev variants before every build. There should be no issues at runtime.

Using Darling

Darling uses DPREFIXes, which are in essence similar to WINEPREFIXes. The are virtual chroot environment with an OS X-like filesystem hierarchy, where you can safely install and run software. Unless you set DPREFIX to your location, the default ~/.darling is used.

The real root filesystem is available through /system-root and the /home directory is automatically symlinked, so you should feel at home right away.

At first use, initial prefix contents are downloaded from the Internet.

Hello world

Let's start with a Hello world:

$ darling shell echo Hello world
Hello world

Congratulations, you have printed Hello world through Darling's OS X system call emulation and runtime libraries.

Installing software

You can install .pkg packages with the installer tool available inside shell. It is a somewhat limited cousin of OS X's installer:

$ darling shell
Darling [~]$ installer -pkg mc-4.8.7-0.pkg -target /

If you have previously downloaded the Midnight Commander package from Rudix, you can now run mc to start MC for OS X. Note that not all Rudix packages may work under Darling, namely the Rudix Package Manager doesn't work, as Darling doesn't yet build its own Python runtime.

You can uninstall and list packages with the uninstaller command.

Working with DMG images

DMG images can be attached and deattached from inside darling shell with hdiutil. This is how you can install Xcode along with its toolchain and SDKs (note that Xcode itself doesn't run yet):

Darling [~]$ hdiutil attach Xcode_7.2.dmg
/Volumes/Xcode_7.2
Darling [~]$ cp -r /Volumes/Xcode_7.2/Xcode.app /Applications
Darling [~]$ export SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk
Darling [~]$ echo 'void main() { puts("Hello world"); }' > helloworld.c
Darling [~]$ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang helloworld.c -o helloworld
Darling [~]$ ./helloworld
Hello world

Congratulations, you have just compiled and run your own Hello world application with Apple's toolchain.