Linux: still better for coding

Wednesday, 04 November 09
Something like one year ago I switched from Linux to Mac OS X. It was not an easy switch if you think that my desktop on Linux used to be this one, that is, just fvmw2 with a minimal configuration, super fast virtual desktop, border-less windows.

Why I switched after more than 12 years of Linux? Actually I didn't decided to switch, just I got a macbook because I wanted to hack a bit with the iPhone SDK and with Mac OS X itself. I installed Linux and Mac OS X in multi boot, and for a few weeks the user interface of Mac OS X was impossible to use for me. But after a few more weeks I was using only Mac OS X for everything.

For the first time I had a system that was working out of the box in all of its parts, it was a good desktop experience with consistent behavior. Screen sharing was cool when working with remote people, no need to hack configuration files or to check why my webcam was not working. To try new programs was as simple as downloading the disk image, opening it, and click on the icon. And.. as optional, the system still usable and responsive while it was performing a lot of I/O! Not something Linux users are used to see.

Note that I'm not the kind of guy that don't want to hack with the system he is using. I even wrote, my drivers, in the past. But it was years ago and I was still willing to trust that Linux after all was young and that it was improving in the desktop side. Now enough is enough, with my computer I want just to focus on what I'm doing without spending hours trying to fix unrelated desktop stuff.

The strength of Linux, or why Mac OS X is weak as development environment



When I say environment I don't think about an IDE or something like this. I used to program with a terminal and vim, and I still code this way on Mac OS X, so in this respect nothing changed. What I'm missing are a number of important tools that made the Linux experience so much comfortable. So here is my list of what's wrong with Mac OS X, or if you want to read it the other way around, of what is cool with Linux.

Valgrind. If you are serious about writing C code you can't live without valgrind. Valgrind turns you into a better programmer. The code you produce is times more reliable after you discover this tool. It is invaluable, and guess what... it started to be usable for Mac OS X only lately, then Snow Leopard came and broken everything already. There are patches that make it barely working with issues (AFAIK things will get better when the new source code of Darwin will be relased), but, this is one of the most important tools of a C developer together with the compiler, it must be rock solid.

Apt-get. Homegrow, Fink, and alike, are great tools, but seriously, they are no way as cool as the apt-get in a good distribution like Debian or Ubuntu. You can find tons of libraries, full systems, with perfect dependencies, fully managed by people that are serious users of this projects, that will tell you that something changed in this new release when you upgrade, "do you want to automatically fix your old config file?" or things like this.

And... the coverage of tools is impressive. From the mainstream to the almost unknown library, there is almost everything. Want the GD lib for Tcl? There is. Want an old release of a lib? Sure. Documentation, full application servers, everything. I can turn a freshly installed Debian system into a production server with everything inside to run a web application in one hour or less (every system administrator can). It's wonderful. And guess what? Developers need to simulate the systems they are developing for, in short time and without too much efforts in order to be productive.

API stability. Mac OS X API, excluding the POSIX calls, change simply too often for my tastes, and there is nowhere the same amount of information you can find about Linux. For instance I compiled nmap yesterday for snow leopard, and guess what, it was not working, unable to open the interfaces. The compiled binary I downloaded from insecure.org worked against the loopback interface but not against the wifi one. The interface to capture raw frames from the airport extreme changed again with snow leopard, breaking valuable programs like Kismac. It's not an open platform so this changes are even worse.

/proc filesystem I know Mac OS X exposes similar informations in other ways, but I sincerely miss the proc filesystem, it was a quick way to explore what was going behind the scenes without having to remember hard-to-remember names to grep.

Compiler. Don't know why but gprof does not work with the standard GCC (the one installed by the official Apple SDK). Tried to compile applications with --arch i386 too, still not working. I bet there is a trivial way to fix it, didn't googled, but it's not OK profiling does not work out of the box with the official compiler.

This are the things that I'm remembering just now, but there are more, little problems that I encounter in my everyday programming experience with Mac OS X that I didn't had with Linux. I still continue to use Mac OS X as my first development platform because while I code I also want a good desktop to surf the web, tweet, chat, and so on, but in order to do my paywork (that's about web development mostly) and my open source development with Redis I've to use a Linux box constantly in order to be more productive.
50376 views*
Posted at 21:51:27 | permalink | 44 comments | print
Do you like this article?
Subscribe to the RSS feed of this blog or use the newsletter service in order to receive a notification every time there is something of new to read here.

Note: you'll not see this box again if you are a usual reader.

Comments

Rob writes:
04 Nov 09, 23:41:40
OSX is Unix. Here, Linux is the odd one. What you complain about not having is what we BSD'ers complain about in Linux.
James writes:
04 Nov 09, 23:44:57
Rob, so you're complaining that Linux has a working Valgrind, Profiler, and a more coherent packaging system?

Seems odd to complain about having more tools at your disposal, but whatever floats your boat I guess.
Nate writes:
05 Nov 09, 01:25:20
Have you tried Mac Ports for 3rd-party sw? I think it's superior to most package systems, including apt. I like pkgsrc and FreeBSD ports though.
Kevin Old writes:
05 Nov 09, 01:45:33
I switched just like you did after years of running Linux as a desktop. I experience the same issues and do all my development in VMware Fusion instances of Linux so I get the best of both worlds.
ian writes:
05 Nov 09, 02:00:51
yeh, macs fucking suck -- and NO they are NOT any form of *bsd -- they have a kernel and that's about it wrt to bsd.... I don't know why there are so many people that have switched to macs lately -- it's slow and costs way too much for what is given -- we need to reverse this trend -- there are a lot of decent devers going to the shit style because of the 'mac' -- the only good things that have ever come out of that was bolo and hotline and if you don't know what I'm talking about then your not even a mac aficionado
scott writes:
05 Nov 09, 02:17:09
well said ian, :D bolo is the best thing that came from macs, i dont understand this apple craze. the os stinks. the hardware is overpriced tremendously. Linux is the way to go unless you need visual studio and possibly any window games that dont work well with wine.
Td writes:
05 Nov 09, 02:28:54
Valgrind and profiling - have a look at Developer/Applications/Instruments
or even better, dtrace
Perhaps the macfuse based procfs implementation would be a work around for /proc
Does http://www.opensource.apple.com/ alleviate the lack of information problem at all?
Stefan Arentz writes:
05 Nov 09, 03:39:06
Lots of complaints all with simple answers.

Valgrind: 'sudo port install valgrind' - this will install Valgrind 3.5.0.

apt-get: Two options here: MacPorts or Fink

API Stability: APIs on the Mac are actually very stable. The UNIX APIs are basically frozen and do what you expect. Capturing raw packets from the wireless card is one of the few things for which no official API exists. Sucks. But it has nothing to do with stability.

/proc - There are other ways.

gprof - This works fine for me on 10.6. But you might want to look at shark instead. Much better.
anti-ian writes:
05 Nov 09, 04:46:05
Oh ian, "...hey have a kernel and that's about it wrt to bsd...", what is Linux if not just a kernel? As far as "wrt bsd", OSX has a rich history steeped in NeXT and CMU-Mach, all wrapped up in a nice userland api pulled from FreeBSD. How is it not Unix again? Unix, being nothing more than a certification any more, a certification that OSX has and that even MS can attain with its posix api and Unix Services for Windows...but not, oddly enough, Linux.

GNU/Linux is a fine OS and on equal footing with OSX and (recent) Windows in all respects but one - usability. Not programmer-friendly, developer usability, but real honest "Grandma can use it" usability. Ubuntu comes close (Karmic notwithstanding) but not close enough. Face it, X11, the windowing system of Unixes everywhere, is crap.

And API stability? Really? Linux isn't exactly known as a bastion of ABI stability with all of its C library incompatibilities. But we know that's all out the door because somebody couldn't get a working build out of what was probably a nightly snap anyway. Why didn't you pull nmap from ports? You could have pulled the source and patches and applied manually...for no reason other than to satiate that hardcore-gentoo-ricer habit!
05 Nov 09, 06:00:19
As a Mac user, I'm still using Midnight Commander. :)

You can always buy a home server and just ssh into it to develop. :) Or a light virtual machine is an option as well. I have choose working on my real web servers.
Andreas writes:
05 Nov 09, 07:28:24
I completely agree. Macports sucks. Why should everyone in the world using macports need to compile everything when debian and ubuntu manages to get to work on all kinds of wierd architectures? besides, all macs are more or less the same so should be tons of easier to distribute bins. and fink? its not even worth to mention...
05 Nov 09, 08:55:07
The Dell I got with Ubuntu 'just works'. Linux can be made to 'just work' these days if the vendor actually, say, tries.

MacOS doesn't have focus-follows-mouse, so I don't think it and I were made for one another.
05 Nov 09, 08:55:07
The Dell I got with Ubuntu 'just works'. Linux can be made to 'just work' these days if the vendor actually, say, tries.

MacOS doesn't have focus-follows-mouse, so I don't think it and I were made for one another.
Mario writes:
05 Nov 09, 12:14:38
On the other hand OS X has dtrace (and GUI wrapper for it called instruments), and dtrace is more powerful that any other debugging tool.
Mister Magoo writes:
05 Nov 09, 13:10:20
No, "dtrace" is not comparable to valgrind, not even in in the slightest. Here's to dtrace, it'll cure what ailz ya !

Next up ZFS !
Haniff Din writes:
05 Nov 09, 14:08:49
My ubuntu desktop looks exactly like mac osx. You can still surf, tweet chat etc. on ubuntu. So what you are saying is an oxymoron really. You can always run linux in vmware on osx, so I really don't see the complaints. I have osx, win 7, xp and unbuntu and use them all.
Not Rob writes:
05 Nov 09, 16:25:59
Rob: haha. Yeah. The package management in BSD is soooo much better than in Debian.

No wait... the other thing. The package management in BSD is so bad that it might as well not have any at all.
the Madman writes:
05 Nov 09, 20:45:01
Interesting... yes, I'm very fond of apt-get as well, but I've tried Gentoo for a while... it's very appealing, but re-compiling all of KDE every month was a pain. Maybe next time, I'll not install the whole thing and just get what I need when I need it.

Still, when it comes to development, I would trust Linux more then I would Mac OS - mainly because many of the libraries are open, so I can have a peak and find out how they work and what they do, change them a bit or find out what I need to sub-class an object (for example).

Part of what I dislike the most about Mac OS is how it kinda, "pretends" it's based on FreeBSD - yet all its applications behave in weird and wonderful ways that aren't actually standard to BSD or Unix at all. What do you mean, you couldn't find the command, "safari"? What do you mean, "Safari.app" is a directory? Where's the executable, then? And it's libraries, where are those? Were are my config files? What's so wrong/broken/whatever about /usr/bin and /usr/lib that you have to go and do your own thing? It's more like one OS hacked right on top of another - something alien slapped on top of something that's supposed to be familiar. *sigh*
John Wiegley writes:
05 Nov 09, 22:26:34
Another vote for shark over gprof. *Much* easier to use -- you don't have to build your app for profiling, for one thing -- and it has a nice GUI for filtering and data traversal.
steve writes:
06 Nov 09, 04:41:37
Is this amateur hour? The comments here are not from real programmers, as they make incorrect points that have trivial solutions.

Devs are moving to OS X because it's really REALLY good to have a machine that works out of the box, AND HAS DOCUMENTATION!

I programmed on Linux for 15 years then moved to OS X BECAUSE OF THE FUCKING DOCUMENTATION. That is worth all CAPS, because it's the single point that matters.
Marco writes:
06 Nov 09, 09:09:34
I have more responsiveness problem on mac os x than on linux, I'm going to think that I'm the only one ...
anyway the real problem for me is that OSX doesn't play well with opensource tools that you use.
You are supposed to use Xcode and its profiling and debugging tools and you should use only apple provided software, those are facts: as soon as you exit from "the right path" everything is harder than Linux. Especially for those parts of the system that apple do not want to expose to developers.
Ethernet layer is a long story about apple breaking things.
The fact is that Mac OS X is good only to program on OSX for OSX, Crossplatform coding on mac is something that really blow me up, even on higher level languages than C.
I had a mac since 1 year but I'm still looking why people switch to it. (I mean programmers not just regular users)
kl writes:
06 Nov 09, 11:23:17
Some of those complaints are valid, but very one-sided.

OS X has great Instruments.app. I could equally say Mac is better for coding because Linux doesn't have Instruments.app :) Everyone has their favourite tool.

For me apt-get is not all rosy. On Debian stable I can't get SVN 1.6 and PHP 5.3 without triggering avalanche of dependencies that requires upgrade of everything, including kernel. Maybe I'm doing something wrong... but I often end up building packages from source on both platforms.

Kismac is using unsupported hack, and it's no suprise that it breaks. Sucks that there's no official API that Kismac could use, and that's core of the problem, not API stability.
Bacem writes:
06 Nov 09, 11:38:13
yes Linux: still better for coding!!
I am actually developing a big application in flex. Even if I don't have the FlexBuilder (available only in Mac and Windows) , I can only work in linux. It is not a choice , it is an obligation.

the reason is simple:
In Windows or Mac, my application takes more than 5 minutes in compilation. however , in Linux, a few seconds. In addition , in linux, I can install database and application server , keeping system stable and fast.

The only big things that are missing in linux are adobe desktop applications.
06 Nov 09, 15:15:48
I really enjoy my Mac for general "interacting with the rest of the world" tasks, but also prefer linux for building the kind of software and systems that I build.

The sweet spot for me is Mac as desktop + VM's for development. That way I can
- dev/test clustered services just as easily as standalone things
- work with things that'd have the possibility to frag my whole system (packaging, automated redeployments) and just snapshot the VM and roll back before trying 'the scary thing'
- work with as many distros (and versions of distros) as I need. Have a centos 4.x up right now for supporting a legacy system, and a small cluster of debian lenny images.

One fun thing to do is have a screen session up and running with your whole development environment in it, and need to power down your Mac for an upgrade. Just suspend the VM, reboot your machine, fire the VM back up and boom, your editor's cursor is still in the position it was when you left.

Especially since the mac has built-in X11, even if I want to use linux GUI tools they just work when I ssh -X in.

Of course if you use linux as a desktop you can do the exact same thing with VM's :)
tb writes:
06 Nov 09, 15:37:52
Agree completely. I stated out as a mac fan and became more and more disillusioned with A as time went by. The iMac bondi blue was my first piece and it still runs just fine. One day I realized that I really, really, REALLY hate it when some turtle necked a***hole can decide when my hardware is deemed obsolete and becomes a brick. With no viable alternatives for keeping it in production environment. Wheres the Damn Small OS X or some such thing? Support for mac (by that I mean using it and developing on it/for it) became synonymous with support for extremely anti environmental practices (including consumption for it own sake).
Rick writes:
06 Nov 09, 18:13:18
And Windows is still better for coding than both of them ;)

cough..cough...Visual Studio
26 Dec 09, 16:23:01
On package systems: I've found that MacPorts has significantly better coverage than Fink. Both are definitely worse than Debian/apt-get though.
Mischa writes:
26 Dec 09, 22:57:23
@david osx does have focus follows mouse. I switched from ubuntu a few years ago and that was one of the first things I made sure I could do.

You have to install an app called "Secrets" or just do defaults.write w/e (see google)
not me writes:
27 Dec 09, 00:06:49
faggots! my mainframe + cobol is better than your gay os's and tools!
Lisa writes:
21 Jan 10, 12:08:24
I found Windows operating system best suited for coding
And the Microsoft Support for windows is much easier and efficient then Linux.
cristy writes:
02 Feb 10, 12:02:58
Well every thing has its pros and cons..
There are certain aspects where linux is better such as it is known to be as most authentic operating system..
It is the only operating system that is effected by only five specified viruses..
But it deals with a limitation too...
It makes the speed and performance of system lazy!!

On the other hand Windows 7 is the best possible operating system used worldwide..
It is optimistic in behavior and approach..
Well featured and designed with advance tech authentication measures..

Easy in maintenance and support.
Visual Studio writes:
31 Mar 10, 00:18:53
Windows is such a complicated mess that even a simple script benefits from using Visual Studio ... there's ways to make development easy that don't compromise the notion of simplicity and elegance. Nothing yet can beat NeXT because the drag and drop auto-generated code (in ObjC) was so readable and understandable you could edit the code for your whole project years later with Emacs (or "ed" for that matter) and not get lost.
Anon writes:
08 Jul 10, 21:48:36
Windows and OS X are very established in many other areas, such as finance, media, design, and gaming. The problem is they are tightly controlled, down to the mouse only input. This prevents them from being used as components beyond their original scope.

Linux is the best for extending yourself beyond a single box -- writing code that writes code, controlling computers to control other computers.

Never forget who controls the tools. Even California's first millionaire knew that.
Ryan Detzel writes:
24 Jul 10, 15:32:44
Wow, I thought I was reading my life story. Same thing happened to me, hardcore Linux user for a decade and I wanted to play with the iphone so I bought a used macbook. A few months later I stopped using my linux box and now I don't even know where it is. I have a 17" macbook pro with vmware running for programming because I want to know that what I'm writing will work in production.
tava tea writes:
06 Aug 10, 23:03:13
It is the only operating system that is effected by only five specified viruses..
But it deals with a limitation too...
It makes the speed and performance of system lazy!!
Robert Sullivan writes:
22 Sep 10, 17:20:29
I've read about Redis as it is used by GitHub, along with Erlang, so I'm interested to see some thoughts from the developer. It's refreshing to see clearly presented reasons for why he likes Linux as a dev platform. No mac bashing, no flamewar, just the facts.

Now the comments in the list, on the other hand, while some have some useful points, really people, let's avoid the "mac os x sux, windoze rulez" blathering.

But that said, aside from the noise, like the above, there are some good points:

* macports looks interesting, too bad it sounds not so great from the comments here. FYI -while there is an option in ap-get (I believe) that supports building from source, I think some of the commenters are confused about the difference. Many times, you will want to compile from source so you get an environment specific build, rather than the generic binary you will apt-get. Simplest example - I want an x86-64 build. That said, when time is of the essence, I'm all for binaries too. And the ease of clicking on a .dmg file, for that matter ;)

* The guy who mention dtrace and valgrind wasn't comparing the two, he was merely pointing out that mac os x has some exemplary tools that other platforms don't have. So it's an excellent point. dtrace is awesome, I believe for a while Sun was going to keep it all to themselves.

* the strong documentation for mac os x is a reasonable plus.

* yes, profiling, outside of an IDE like Xcode or eclipse might not be the greatest on the mac, so yes, obviously the mac is geared towards developing for iOS and Mac OS X. But it's people that make the difference, if you like working on the Mac, and have a particular profiling tool that doesn't run (at all or well) on the mac, scratch an itch. This is how great software is greater.

* If someone has 12 years of solid experience on Linux (or windows, or mainframe), then that's obviously a consideration. If you've been building device drivers and who knows, compiling your own kernel, and know the platform at that deep of a level, by all means. So to conclude, it's pleasing to see real facts here, use whatever is best for your requirements and have fun! Thanks for the tips.
error! writes:
30 Sep 10, 15:20:37
Linux is a fine OS and on equal footing with OSX and (recent) Windows in all respects but one - usability. Not programmer-friendly, developer usability, but real honest "Grandma can use it" usability. Ubuntu comes close (Karmic notwithstanding) but not close enough. Face it, X11, the windowing system of Unixes everywhere, is crap.
mintothomas writes:
17 Nov 10, 03:03:42
Linux is a fine OS and on equal footing with OSX and (recent) Windows in all respects but one - usability. Not programmer-friendly, developer usability, but real honest "Grandma can use it" usability. Ubuntu comes close (Karmic notwithstanding) but not close enough. Face it, X11, the windowing system of Unixes everywhere, is crap.
scotty lee stewart writes:
01 Dec 10, 05:40:51
LINUX is better than windows as compared in OS functioning and its also cheap but the article here is somewhat very useful and i used this to know further instructions..thank u
freelancer flash designer writes:
24 Dec 10, 08:58:09
You can use a Linux box constantly in order to be more productive, using open source development with Redis.
regards,
<a href="http://www.echofreelance.com/";>Freelance flash designer</a>
freelance web designer writes:
29 Dec 10, 15:01:17
This post is for Linux users you just simple as download the disk image, opening it, and click on the icon.
regards,
<a href="http://www.echofreelance.com/";>Freelance web designer</a>
random banter writes:
23 Jan 11, 06:35:05
I agree that ABC is better than XYZ, especially when it comes to quality. I have been using ABC for the last 3 years it never dissapointed me. Does anybody know when the new version is coming out?"
http://www.rcaieftina.net writes:
23 Mar 11, 09:26:13
Linux is a fine OS and on equal footing with OSX and (recent) Windows in all respects but one - usability. Not programmer-friendly, developer usability, but real honest "Grandma can use it" usability. Ubuntu comes close (Karmic notwithstanding) but not close enough. Face it, X11, the windowing system of Unixes everywhere, is crap.
Kevin Sheen writes:
18 Apr 11, 21:39:48
This is clearly a troll blog post. Your lack of love for OS/2 warp gives it away.
comments closed