Packaging Linux Apps Inside Mac Bundles

Since my problem does not directly address Xojo, it may not be appropriate to ask for help here, but even suggestions about where better to go would be welcome. (i have tried the paid xojo consultant route, but have heard nothing back.) I believe my problem is familiar: Linux app installers splatter pieces all over the place (like /usr/local) that are incompatible with sandboxing. NStask works fine from within Xojo, but only for linux apps that were installed separately.

Recently an Xcode developer (Andy Duplean) has posted an Xcode addin (at that apparently goes into the sources of an Xcode project and changes them soas to keep things together. I have communicated with him and have attached his characterization below.

My problem is that I do not understand how to get a Linux source into Xcode. I have read about a “G” switch in “cmake” but C and Linux and Xcode are foreign to me. If anyone has done this step and could explain how they did it, that would be very useful. If anyone is game to try, the app I am personally stuck on (“PROJ” at is small, current, and widely used, so might be a good candidate.

Obviously, once I can get an app into Xocode, I still have to figure out what Andy has done, but that is step two.

James Bailey

Here is how Andy characterizes his work:

"the script is indeed for packaging libraries up into the app bundle that exist on the developer’s machine that are non-standard and therefore not expected to exist on the user’s machine. These libraries would have been installed by the developer on their machine using homebrew or macports (which are nothing more than the package systems you find on linux distros).

You are correct in that it only works in Xcode and one of the best ways of generating an Xcode project is to use cmake to define the project sources etc. and generate an Xcode project as-and-when required. Once in cmake you can also generate Makefile, Visual Studio, you-name-it projects for use during development. My script would then be used as a post-build step in order to copy non-standard third-party libraries into the app bundle. However you need not use it and could simply write a shell script to perform the copying and “install-name” operations given your dependency library will not change much over time."

I’d just like to ask, do you mean actual Linux applications or macOS applications run from the Terminal.

I’ve not tried to use Linux apps on my Mac, but I have a couple of applications that include and use console applications, via NSTask from Sandboxed applications. If this is inline with what you’re doing, then maybe I can help?

I think I mean Linux apps, at least at the source level. They all seem to have Mac binary installs, but these are what I am trying to get around. The theory seemed to be, and this is what I am testing, that sources written with Linux in mind can somehow be imported into Xcode in source form and then compiled there into Mac executables. I am guessing that, for someone who knows the ropes, downloading the sources and compiling for Mac OS X, independent of Xcode, is pretty routine. I am hoping to detour that process through Xcode.

I think there’s a couple of things here; which I want to try to understand.

  1. You mention that console applications can’t be used via NSTask from a Sandboxed application. This I can help with because I use console applications via NSTask in a Sandboxed application.
  2. It appears that some of these apps install shared components all over the place, rather than grouped together in a single location. This I can’t help with.
  3. To avoid components being installed throughout the system, you want to recompile these applications using Xcode. While I use Xcode, it’s in frequently and almost never to create an entire application. This is probably something I can’t help with either.

Do this sound about right?

Thanks Sam for your continued interest here. I believe you have characterized the playing field correctly. For background, I should fill in what I am up to. College life science students routinely download and use Linux open source apps in their work because that is the best way to get the kinds of visualizations they need. The irony is that high school kids can easily understand, and benefit from, those visualizations, but they are not going to learn Linux just to run them. My role is to provide a simple GUI interface to the Linux executable, written in Xojo. For this to be foolproof, however, the Linux executable has to be bundled right in my Xojo app bundle. For that, I need a well-behaved , self-contained executable. The lure at this point is the script mentioned in my initial post that promises to modify Linux sources to this end, but only if I get them over into Xcode first.

I am now resigned to putting in the work to learn cmake and Xcode in order to master this process. I will report back on my progress in a month or so. These environments have a formidable learning curve.