Skip to content
Karton - Run Linux programs on macOS, a different Linux distro, or a different architecture
Branch: master
Clone or download
Latest commit 5a9c46a Mar 7, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs Update the DefinitionProperties docs Mar 7, 2018
inception
karton Release Karton 1.0.0 Mar 7, 2018
logos
scripts Re-enable some pylint check after some code refactoring Feb 21, 2018
tests
.ackrc Add an .ackrc file for ack (AKA ack-grep) Feb 17, 2017
.gitignore
AUTHORS
COPYING Add licensing information Jan 14, 2017
COPYING.LGPL2
Makefile
README.md Fix the initial links in README.md Mar 15, 2017
changelog
setup.cfg Add a setup.cfg file which points to the README.md file Feb 9, 2017
setup.py Improve the descriptions in setup.py (for pypi) Mar 14, 2017

README.md

[Web site] – [Install] – [How to use] – [FAQ] – [Contribute]

Karton

Karton is a tool to transparently run Linux programs on macOS or on another Linux distro.

$ uname -a # Show we are running on macOS.
Darwin my-hostname 16.4.0 Darwin Kernel Version 16.4.0 [...]

$ # Run the compiler in the Ubuntu image we use for work
$ # (which we called "ubuntu-work"):
$ karton run ubuntu-work gcc -o test_linux test.c

$ # Verify that the program is actually a Linux one.
$ # The files are shared and available both on your
$ # system and in the image:
$ file test_linux
test_linux: ELF 64-bit LSB executable, x86-64, [...]

$ # Same thing but on 32-bit ARMv7 (in the image we
$ # called "ubuntu-work-arm"):
$ karton run ubuntu-work-arm gcc -o test_arm test.c
$ file test_arm
test_arm: ELF 32-bit LSB executable, ARM, EABI5 [...]

$ # We can run the ARM program:
$ karton run ubuntu-work-arm ./test_arm
[... Output of our program ...]

In another terminal you can attach to the running program and debug it.

$ # Find the PID of the test_arm program.
$ karton run ubuntu-work-arm ps aux | grep test_arm
test_arm    42  [...]  test_arm

$ # Debug it!
$ karton run ubuntu-work-arm gdb --pid 42
GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.04) 7.11.1
Copyright (C) 2016 Free Software Foundation, Inc.
[...]
Attaching to process 11
[...]
0x00007f53430e4740 in __nanosleep_nocancel () at ../sysdeps/unix/syscall-template.S:84
84	../sysdeps/unix/syscall-template.S: No such file or directory.
(gdb)

In the example, by prefixing your commands with karton run ubuntu, you can run them on Ubuntu even if you are using macOS (or another Linux distro!). Files are shared across the two operating systems and executing commands like this is very fast, making the whole experience smooth.

Karton uses Docker 🐳 to create a semi-permanent container where all the commands are executed. The management of this container is transparent to the user, who doesn't need to worry about the Docker-related details.
Karton images can also be easily configured to share files or directory with your host system.

You can’t perform that action at this time.