Darwin/macOS emulation layer for Linux
Go to file
2016-02-19 17:01:35 +01:00
benchmarks ObjC runtime work: objc_msgSend and objc_msgSend_stret, ivars support, working class reg (w/o protocols), trivial benchmarking framework 2012-10-03 23:37:58 +02:00
cmake Darling can now build and run OS X executables in ELF (used for internal binaries) 2016-01-12 00:21:49 +01:00
compiler-include Initial commit, some libc modules building 2014-12-04 01:11:22 +01:00
etc Add libpcre and many missing command line tools (#113) 2016-02-09 22:53:20 +01:00
kernel-include Preparations for building launchd 2015-12-12 14:45:56 +01:00
misc Improved Darling logo, courtesy of noway()2ch.hk 2014-05-06 16:05:50 +02:00
platform-include Added shell_cmds submodule, building some executables from it. 2015-12-21 00:56:09 +01:00
src Fix a crash in sys_execve() when executing scripts inside of DPREFIX 2016-02-19 17:01:35 +01:00
tests Removing Git submodules 2014-01-06 20:47:37 +01:00
tools Build extra aliases on i386 to workaround an ABI compat issue 2015-12-15 18:58:01 +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 Add zip/unzip and friends 2016-02-19 00:20:46 +01:00
CMakeLists.txt Moved the initial AppKit code into sepatate submodule 2016-02-12 18:58:28 +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 More READMe style improvements 2016-02-11 09:57:41 +01: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
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
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.