Last chance to enter The Hackaday Prize.

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.

Comments

  1. Andreas Sauer says:

    Major temperature droppage in hell.

  2. Alex Rossie says:

    Meh, not really accurate, he’s developing on linux. He may as well code onto a usb and carry it over to another pc.

    I also find ssh very hand.

  3. andrew says:

    I do this via ssh all the time using dashcode and cyberduck.

  4. Tobias M says:

    Why the hell do you WANT to use xcode? Its the worst thing ive ever used! I want to see that article with Visual Studio

  5. Ricardo Dias says:

    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.

  6. goo says:

    Hm, why not developing Linux applications on a Linux machine?

    • Ricardo Dias says:

      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

    • hatenull says:

      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.

      • Awasson says:

        @hatenull: Why would you go ahead and show your ignorance in all things Linux. OSX is FreeBSD Unix with a fancy paint job.

      • Ken says:

        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.

      • hatenull says:

        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.

        • Rowdy Piper says:

          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.

  7. Frank says:

    SSH is truely hand in many situations

  8. No One says:

    @goo: Your question is answered in the second sentence… He like Xcode as an IDE.

  9. Daniel says:

    Lol, are cross compilers really that old fashioned to use?

  10. Ken says:

    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.

  11. Ellen says:

    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.

    • Pilotgeek says:

      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.

    • Ricardo Dias says:

      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

    • Ken says:

      “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.

    • Rowdy Piper says:

      yawn. I hope Micro$oft pays you well for making a fool of yourself like this.

  12. ejonesss says:

    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.

  13. Daid says:

    … 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.

    • Ricardo Dias says:

      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

  14. aarku says:

    That’s Xcode, not XCode.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 91,131 other followers