Rixstep
 About | ACP | Buy | Industry Watch | Learning Curve | News | Products | Search | Substack
Home » Learning Curve

'If you can't type - click'

You don't even have to think a lot to be playing it smart.


Get It

Try It

Curious, isn't it, that just when Microsoft can finally brag their command line is gone just like Apple, Apple bring it back again?

It just goes to show Microsoft are always in the wrong place at the wrong time.

Apple's new OS X is not a successor to their classic 'MacOS'. It's a totally new operating system they bought in 1996 from NeXT Software, Inc. And it runs on an underbody of Unix known as FreeBSD.

The open source contributions to the wealth of Unix software are legendary, as are the authors. One sees really heavy names in here from NASA, Lawrence Livermore, Los Alamos, CERN, and about every major research institution in the world.

And all that software is there on your computer already and you didn't even know it.

But there's a catch: as Unix was originally a command line OS, so are these programs. To access and run them you have to normally use Apple's Terminal application.

A lot of people new to OS X (and Unix) had little idea all this great stuff was already there on their disks. And when they searched around for solutions to their everyday tasks, they ran into the wrong crowd.

There have been too many amateur software authors reasonably acquainted with the Unix underbody and willing to make a killing. Probably more than half the products reviewed in The Very Ugly section are of this type.

Some want fortune, others only fame, and a few probably think they're doing everyone a big favour.

Their 'applications' often lump commands together in ways you might not find helpful. Sometimes if you don't choose all their commands you can choose none. And you're never told what's really going down.

And it gets even worse when they demand your admin password. And what are you thinking? You're thinking 'oh I have to prove who I am' - which is all wrong. You don't have to prove who you are! But these 'applications' want to run as 'root' on your computer and they still don't think it's your business to know what they're doing!

Anytime you give your admin password away to anyone - physical person or software product - you've just given someone the keys to your property. Once they have that password they can do anything - anything - and you won't know it or be able stop it. And you might never know what really happened.

You can trust Apple and the people who created that incredible wealth of Unix software installed on your computer, and you can trust yourself if you learn how to 'read' the commands you issue to your system - but you can't trust anything or anyone else. And you shouldn't either.

Knowing where to begin with all this Unix stuff on your computer can be difficult. A good place to start is probably the defaults command. It's used by most of the 'system maintenance' utilities for at least 80% of their functionality - something they don't really want to reveal.

defaults

defaults is a command line program written by the crew at NeXT. It's part of the NeXTSTEP/OS X system. It's found in /usr/bin.

% ls -al /usr/bin/defaults
-r-xr-xr-x  1 root  wheel  34516 Jan 28  2003 /usr/bin/defaults

defaults takes care of your application and system preferences. Your own preferences are found in ~/Library/Preferences; the system wide preferences are found in /Library/Preferences - and all these preferences are stored in what are known as property list files.

A property list file is a file in an XML format. It's plain text and structured with keys and values. The keys are ordinary text string identifiers; the values can be of different types. Here's an example from .GlobalPreferences.plist.

    <key>AppleAntiAliasingThreshold</key>
    <integer>8</integer>

This says that the antialiasing threshold (the smallest font size when the system is to start antialiasing fonts) should occur with font sizes of eight points or higher. It's as easy as that.

Here's another example from the same file.

    <key>AppleAquaColorVariant</key>
    <integer>1</integer>

This says that the Aqua colour scheme is to be 'Aqua'. Another value would result in everything being rendered in graphite.

A final example.

    <key>AppleHighlightColor</key>
    <string>0.749000 0.847100 0.980400</string>

This sets the colour of highlights - selected text, whatever. These are three floating point values for red, green, and blue in that order. 0.0 is no colour and 1.0 is full colour (for that component).

All of the files with the extension .plist in your two preferences directories are files of the above type. They're all plain text - but in XML format - and can be modified with the defaults command.

defaults can both read keys in property lists, modify them, and remove them entirely.

A large part of your system configuration is determined with these property list files.

[Note: starting with OS X 10.4 'Tiger' these property list files are stored by default in a 'binary' format. They won't appear as plain text. They can however be converted back again very easily with the command 'plutil -convert xml1 <filename>'. defaults works with both formats.]

The Unix Paths

The underbody of your OS X computer has four basic locations for its Unix command line tools.

/bin     /usr/bin
/sbin    /usr/sbin

/bin and /usr/bin are ordinary user commands; /sbin and /usr/sbin are meant more as 'system' commands (for administrators).

All told you should have over 900 such Unix programs on your hard drive. What functions the 'system maintenance utilities' don't get with defaults they will get here - few of these utilities actually contain their own code: they're just calling the Unix programs you could call yourself.

Even the 'widgets' that come with and are written for OS X 10.4 'Tiger' fall mainly in this category: when dealing with the local system, they just call the Unix programs you already have on disk (but know too little about).

You don't have to type

But thanks to CLIX you don't have to become a Unix rocket scientist or type anything at all. You prefer point and click? Fine. Point at a CLIX command file and double-click it, opening the file with CLIX. Use the mouse to scroll through the commands. When you find what you want, double-click again, bringing out the command sheet. Then click 'Run'.

That's it.

There are over one thousand commands shipping with the current version of CLIX - much more many times over than any 'system maintenance' utility is going to give you. But it can be daunting: you won't know quite where to begin.

So start with the easy stuff: start with defaults commands. Safe stuff - for your desktop, for application settings, and the like.

You prefer Apple Mail to always render messages in plain text? Fine. Double-click desktop.clix. Click the header for the 'Category' column. Scroll down until you see the 'Mail' commands. Find the command 'Prefer Plain Text On'. Double-click it. When the command sheet comes out, click 'Run'.

Your Apple Mail will now render all messages in plain text.

desktop.clix alone has nearly three hundred commands, most of them using defaults. Browse around and see what you find.

There are plenty other CLIX command files for cleaning out your system; for doing stuff with your disk, disk images, and Disk Utility; for listing stuff all over your system; for reading and dealing with the numerous log files in your system; for removing unused 'localisation' files; for interfacing with a network; and for your privacy and security.

Learn as you go

And it's easy to become proficient at this - CLIX comes with two built in systems for accessing your on disk documentation for the Unix commands. You can see a couple of screen dumps of this system in action here.

You'll have to type in the command name and hit Enter, but you should manage just fine.

See Also
CLIX 1.7.2(a) 'Ilgaz'
PlistEdit: Thwarting Tiger & Friends

About | ACP | Buy | Industry Watch | Learning Curve | News | Products | Search | Substack
Copyright © Rixstep. All rights reserved.