1 August 2008

What Is This Thing Unix, Anyway?

This carries on from my previous post. I don't think anyone that might stumble upon my blog (if indeed anyone does) will really be interested in this stuff, but what the heck.

I have a MacBook. The operating system it runs is called Mac OS X. But I don't really think of myself as a Mac OS user. I'd rather identify myself as a Unix user. It might come as a shock to some old-school Mac users that the modern Mac OS is, in fact, a UNIX® system. The graphical user interface is so, well, Mac that a casual user might not even be aware that beneath the surface lies a powerful core operating system, the roots of which go at least as far back as 1970.

So what exactly is Unix, anyway? There's no one official Unix or one official user interface to Unix, like there is for Windows. The Unix system branched quite early on into many operating systems developed by different commercial and academic groups, and also spawned clone systems like GNU/Linux. The design philosophy of all the competing Unices has remained very similar, though, and the systems are quite compatible with each other (there are certain standards that all certified Unix systems must comply with, and which non-certified, so called Unix-like systems, like GNU/Linux systems, generally also comply with). The command prompt, the place where hardcore Unix users are most at home, is the portion that has probably remained the most constant (from a user point of view).

But in the modern world few of us are happy with just a text console. The vast majority of software today is graphical. Now, most of the various Unix systems have adopted a version of the X window system as their graphical interface. This makes porting software from one Unix to another fairly easy. Mac OS X, however, has it's own graphical interface, although it is possible to install an X server as well and run X applications side by side with regular Mac apps. There's nothing wrong with the Mac OS X interface as such. Quite the contrary, it is a very usable system and looks good too. However, there exists a certain dualism that separates the graphical environment and the Unix core, as I mentioned in my previous post. Much of this is to do with the way Mac OS X handles most native applications, which are distributed as ready to use bundles. The binaries and support files are contained within a single app package and not in the usual Unix file hierarchy. This means you can't easily run OS X apps in the normal Unix fashion, using just the application's name as a command at the command prompt.

So how can we make Mac OS X act and feel more like a real Unix, which it's supposed to be? Reclaiming the command prompt is pretty much the only way. There are a few simple commands that make life in a terminal window much more pleasant. The 'open' command is crucial. This is the bridge between the command prompt and OS X's app bundles. Since Linux and other Unix systems don't usually have a similar command (as you can run the application using it's name), it is easy for a newcomer to OS X to miss it. I did, for too long. You can also use Quick Look from the command prompt with a little tool called 'qlmanage', which is handy, though not as crucial as 'open'. MacPorts is an important tool and source of Unix software, even if it's software selection isn't complete and many ports are outdated versions. Obviously you'll want a proper text editor, like Emacs or vim. (If you use an app bundle version, make sure you make it the default app for plain text files. That way you should be able to open it with the 'open -t' command, even with files without a '.txt' extension.)

I still haven't figured out if it is possible to get Finder to see Unix system folders and hidden files. While in most cases it's more convenient to browse and manage them in a terminal, it would still be nice. Any ideas? Any more ideas about better approaching OS X in a Unix fashion are also appreciated, if anyone with experience of such things actually happened to read this.

Well, this grew into another really long post with no real purpose. Mostly I guess I'm just organizing thoughts that have been going through my mind during the past week, not really expecting anyone else to be interested in this.

No comments:

Post a comment

Note: only a member of this blog may post a comment.