Using A Mac And XCode As A Linux Development Platform

[Ricard Dias] wrote in to tell us about his guide for developing Linux applications on a Mac. He really enjoys the development environment provided by XCode, and it doesn’t take much to make it work as an all-in-one solution for Linux development.

The real trick here is the use of SSH to access a Linux environment. In this example he uses Ubuntu running as a virtual machine, but also mentions that the same thing can be done just as easily with a separate box as long as it is on the same network as the Mac. SSHFS (the SSH Filesystem) lets him mount the development directory on the Linux box locally. This is where the XCode project and files will be stored, but building the program will be done by the Linux machine via a script calling the make comand via SSH. To test out the newly built program, [L] tunnels in using X11 forwarding for ssh, and the application will be shown as a window in OSX, even though it is running on the Ubuntu machine.

We love SSH and use it all the time. It’s amazing how hand it can be.

28 thoughts on “Using A Mac And XCode As A Linux Development Platform

  1. Firstly, thanks for the post ;)

    Regarding the comments, I’m actually working in a robotics project which requires me to develop on Linux. I started using the VM to write code and build, but I found out that is the way I’m more productive, because I was really used to the XCode programming interface. (no I’m not a fan-boy ;P)

    Andrew, I really appreciate your reference to cyberduck, as I didn’t know it, and sure I will try it out too.

    1. Good point :D

      Well, as I said before, I started developing in Linux using the VM, but I was experiencing a lot of annoying bugs, which caused me a drop in productivity in terms of time. And, my friend, as you know, time is money ;)

      Regards

    2. He is developing on a linux machine, just a proprietary expensive version of linux that is locked into overpriced pretty boxes. OSX is linux! Why act like it isn’t? It destroys all concepts of the GNU and what linux is supposed to achieve, but it is the same code, the same command lines, everything is identical under the basic user layer. Not that many Mac users would ever get past their pretty GUI.

      1. OS X is (certified) Unix, but most surely not linux!

        OS X is derived from Mach + BSD by way of NextStep. It liberally includes GNU utilities, and has given back to the free software community in the form of Open Darwin. Incorporating free software in commercial products is not generally frowned upon by free software advocates. Personally, as a free software developer and advocate, I encourage it. Commercial development of free software has proven critical to its progress, and its widespread adoption encourages interoperability.

        “Not that many Mac users would ever get past their pretty GUI.”

        That’s just abusive. Macs were the computer of choice of the world class, multi-talented, professors I had the pleasure of studying and working with in Carnegie Mellon’s CS dept.

      2. You’re right actually I was showing my ignorance. I only know about OSX from having to recover a friend’s machine after a kernal panic due to a bad update that got pushed out. (Because macs never crash…) I didn’t dig to find what kernal it was, only that the command line was familiar to a long-time linux user and easy to fix.

        As for my other comments, I shouldn’t post after a long shift of being annoyed. They were offensive, no matter what my opinion of most Mac users is. Sorry to those offended.

        1. You are a moron. If you can’t even tell than OS X is NOT Linux there’s no way in hell would you be able to “recover a friend’s machine after a kernAl panic due to a bad update.” Get out.

  2. In most cases I prefer to develop locally under OS X. All the popular F/OSS development tools and libraries are available (e.g. from MacPorts). Make sure the project builds on multiple systems by fixing make or configure files for multi-system compatibility when new libraries (or other system dependencies) are added.

    As for sharing filesystems, I either use the sharing facilities provided by my virtual machine system, or use SAMBA.

    No comment on XCode, but it seems like it ought to work locally if it is useful for the remote builds mentioned in the article.

  3. Um, why pay $3000 for a locked down, DRM-ridden wanna-be OS when you can have the Real Linux Experience for 1/3 of the price and all open source? Besides, /real programmers/ don’t need an IDE. (Speaking as an Ex-Visual Studio user)

    OSX is not BSD. OSX is may conform to POSIX, but nowadays that’s like saying a car has 4 wheels and an engine. OSX is Mach with parts of BSD hacked onto the side because Mach has such terrible performance.

    1. I’m all for bashing OSX, but really? You can get a Modern Mac for FAR less than $3k. It’s good for running many proprietary software packages on it (of course, Photoshop). They aren’t perfect, but they do their job and are well-built. Some people actually do not care if the software they use is open or not.

      Also, “real programmers don’t need an IDE” is true, but you also have to start somewhere. You said yourself that you used to use one. One does not just instantly become the world’s greatest programmer.

    2. You are free to go and write another tutorial on the net on how to use VIM (one the “real programmers IDE”). I like TextWrangler too, but ut doesn’t give me the possibility to compile directly.

      Again, I’m not a Mac/XCode fanboy, I just posted a solution for a problem I encountered while running other IDEs in VM. If it helps someone I’ll be happy, but I’m not trying to convince you that it’s better to program in XCode rather than any other IDE.

      Best regards,
      Ricardo

    3. “OSX is Mach with parts of BSD hacked onto the side because Mach has such terrible performance.”

      Funny – I though all the microkernel purists had left the building. Even the GNU HURD puts device drivers inside Mach’s kernel space. The failure of purist microkernels is not and has never been a problem for deploying hybrid Mach based systems.

      I’ll start listening when you find legitimate faults with XNU, but the choice of proven BSD services, modern device driver architecture (IOKit), in a modular kernel framework (Mach) looks pretty bulletproof from where I stand.

  4. you can then write for anything from anything including ipad.

    if you can write out a text document then you could write code and save it as plain text and then take it to the machine you want to compile on and compile.

    it is basically a glorified text editor with a compiler and and run time library.

  5. … He is storing his ssh password in a script file. That’s pretty stupid, as public/private keys would handle authentication better without the possibility of someone seeing your password.

    1. Thank you for your comment. That’s a good point when you are concerned about security. I used it in plaintext because I’m using a VM, which is used only for compiling purposes, not accessible from outside, so I’m not that worried about it. However, that’s a good point when you use a real box, especially you have important piece of information there.

      Best regards

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.