Cocoa Programming on Ubuntu

After watching “The Internship” with Vince “You’re So Money” Vaughn and Owen “Lighting McQueen” Wilson I headed off to upgrade my ASUS Pentium lubuntu laptop by getting an Acer Aspire M i5 15″ and immediately installing Raring Ringtail lubuntu 13.04.

What a dream machine.  This thing can take anything I throw at it (Netflix, Steam, Dolphin GameCube/Wii Emulator) and networking on it is unexpectedly good – I read many had problems.  Its also sleek and a cool dark silver metal.

The best of all is you need not stop coding Cocoa because you like Ubuntu.

Here are four steps to take to do some Cocoa Programming on Linux while you are away from your Mac and Xcode.

1. First install gnustep.  You can do this from the Synaptic Package Manager GUI by searching for gnustep or from the shell:

  • sudo apt-get install gnustep gnustep-devel

2. Next get yourself a good code editor that understands Objective-C syntax like Sublime Text 2:

  • sudo add-apt-repository ppa:webupd8team/sublime-text-2
  • sudo apt-get update
  • sudo apt-get install sublime-text

3. Write a shell script for making builds easily that contains the following line of code:

  • gcc $1.m `gnustep-config –objc-flags` -lobjc -lgnustep-base -o $1

Remember to chmod 777 the file. I call it

4. Test the following HelloWorld.m program:

#include <Foundation/Foundation.h>

int main(int argc, const char* argv[])
 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
 NSLog(@"Hello, World!");

[pool drain];
 return 0;

by running ./ helloworld and then ./helloworld on the shell.

This is my output:

cocoa@allocinit:~/dev$ ./ helloworld
cocoa@allocinit:~/dev$ ./helloworld
2013-06-09 16:12:50.885 hello[15826] Hello, World!

That’s it.  I’m from the camp that thinks Xcode is an awesome tool and Objective-C is a super language with Cocoa being an amazing framework.  Having it available on Ubuntu just gives me more places to practice my model like Objective-C coding.

One thought on “Cocoa Programming on Ubuntu

  1. Pingback: Open Source Swift on Ubuntu | [[Cocoa alloc] init];

Leave a Reply

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

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

Facebook photo

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

Connecting to %s