Is there a way to run a Linux binary in macOS? I tried to run a binary but it said it isn't executable.
Update years later: The Noah repo has now been archived. I haven't found a good alternative.
I recently starting using Noah to run Linux binaries in macOS. You can install using homebrew (
brew install linux-noah/noah/noah). Then you should be able to do this:
In my experience the behavior of the binary matches what I see on my Ubuntu machine.
These answers are half correct, because virtualization is a choice but there is another. May I present...
- First there was UNIX, circa 1972
- Then the Timeline Split
- In 1977, for $90, Bob Fabry and others, compiled/built the first versions of BSD, short for Berkeley Systems Distribution.
- In 1991, Linus Torvalds posted in a Newsgroup, about software he used from Richard Stallman, who started GNU in 1983, and Linus'es UNIX was born.
- Apple reacquired NeXT Software in 1996, after Steve Jobs was fired from Apple in 1984, and used the software and people there to build OS X. OS X is the Darwin OS + the NeXT Desktop Environment. And now we're back to Bullet #1, as Darwin is a closed source fork of BSD. For the Open Source Project, see PureDarwin. For the Official Apple Developer Page, see Apple Open Source.
How We Can Use This
BSD's traditionally use the Ports system for Package Management. The most widely used of these are the FreeBSD Ports. Ports are packages installed directly from source. Since the same Linux applications come from the same sources, you can run a Linux application if its port exists. Don't use these Ports on a Mac because...
- Install XCode for your version of OS X.
- Bundled inside XCode is Apple's version of the GCC Compiler, and all the other associated tools. To update the tools, see this post on StackOverflow. The tools are OS Version dependant, ie they are not backwards compatible, to my knowledge (in short, don't install XCode for 10.8 on 10.6, etc.)
- Having installed XCode you now have a compiler, and can head on over to the MacPorts page and browse for the port you need installed, after installing the MacPorts .pkg installer
The ports system doesn't necessarily do dependency checking, unless the port was well written. I lightly touched on the problem in what does elibc_FreeBSD mean in gentoo portage overlays?
There's also Qemu, which will virtualize different CPU types i.e. Intel or Power etc.
There is also software layer emulation, with programs like WiNE, and my own emulayer program(WiP) Both of these partially emulate the Windows OS by converting the system calls to POSIX.
Most Linux applications will run on OSX with a source recompile.