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

A Path to Unix

Things/have/changed - they're:not:like:they:used:to:be.

Way back in the mists of time everything was determined by the telex machine. As signals came across the wire, the telex would react. As a telex was a glorified typewriter, you had a carriage - and this because the thing had paper in it and the telex was expected, as was the typewriter, to actually print on the paper (and this was before white-out too).

To begin printing at the beginning of the next line, the telex had to be sent two signals: one to return the carriage all the way and the other to advance one line.

Surprisingly these two signals became known as carriage return (CR) and line feed (LF), their corresponding hex values holding to this day: 0D and 0A respectively.

In the world of computers this makes no sense: files are mere streams of bytes and a single byte is all that's needed to say 'go to the beginning of the next line'. (Hold down your right arrow key through a text file and follow your caret and see.)

Once things had in most circles progressed beyond telex, the need for two signals to do one job disappeared; in the world of Unix the CR was ignored and the LF did both operations in effect. The nearly universal signal for CRLF thus became 0A.

But Apple, the 'think different' company, decided to go with the carriage return (CR) instead, and Microsoft, the company who never think, decided to do nothing.

In the world of paths the story was the same. Microsoft used CP/M drive letters (and still do) whilst Apple decided to use the colon (':') as a path component separator.

Old Mac paths don't have a root because the concept is somewhat alien: MacOS can't see things in terms of paths anyway - not really. (And hold on, for this is true.)

On old MacOS you need both a reference to a directory and a file name to access anything. If the directory is contained in another directory, you need the ref to that second directory to find the ref to the first one. And so forth.

You can see this in 'carbonised' OS X apps even today - iTunes being an example. With paths like:

System:Library:CoreServices:Classic Startup.app:Contents:Resources

And so forth. The idea of determining whether the path is absolute or relative is moot: they're all absolute. 'System' has to occur right under the top hierarchical level.

Ouch.

Thus to expect Maccies in this context to implicitly understand that '/' actually means something and that '~' means something even more important might be a bit too much for now.


The basics:

  1. If a Unix path begins with a slash ('/') it's an absolute path.
  2. If it doesn't begin with a slash, it's a path relative to your CWD*.
  3. If a path begins with a tilde ('~') it's relative to your home directory.

*CWD above refers to 'current working directory' and every process at all times has a 'current working directory'.

Everyone on Unix has a home directory, and this directory is very important. You can always abbreviate this path with a tilde.

Anything after the tilde is relative to your home directory.

  1. ~/Library is your Library directory, not any other.
  2. ~/Applications is your Applications directory, not any other.

Cocoa admits of hundreds of standard paths for executables of all sorts. The Lightman application can enumerate these.

For the purposes of installing application software, you have a number of paths available.

    ~/Applications
    ~/Applications/Utilities
    ~/Developer/Applications
    ~/Applications/GrabBag
    /Applications
    /Applications/Utilities
    /Developer/Applications
    /Applications/GrabBag
    /Network/Applications
    /Network/Applications/Utilities
    /Network/Developer/Applications
    /Network/Applications/GrabBag

Your own Applications and Utilities directories correspond to those found under root; your own Developer/Applications directory corresponds to the same found with Apple's developers tools; the 'GrabBag' directories, seldom used anymore and from NeXTSTEP, are specifically for software under development.

Applications found in your home area are for you and you alone. They will normally be marked with your username and group.

Applications found under root will normally be owned by root and belong to the 'admin' group (of which you are normally a member). Applications found under root are available to anyone logged in to your computer.

Note as well that the standard paths do not include anything in the /System hierarchy: this is and should remain the domain of the operating system and nothing else.

Installing software under root always implies difficulties. These directories are normally owned by root and only root can change the ownership of a file. Therefore an installer is necessary and that installer must be given your (admin) password so it can escalate to root to set the file ownerships correctly.

It's messy; you can trust Apple - after all, if they were on your case they'd have compromised your hard drive already in the factory (and then their name would be dirt and it wouldn't be good for sales exactly) - but it's not a great idea to trust anyone else.

  1. The /System hive belongs to your operating system. Stay out.
  2. The other root directories (/Applications et al) belong to root.
  3. Your directories (~/*) belong to you - and you can keep everyone out.
  4. Your directories are the proper place to install most everything.

Remember:

  1. A slash in the beginning means it's an absolute path.
  2. The lack of a slash means it's relative to your current directory.
  3. A tilde ('~') means it's relative to your home directory.
About | ACP | Buy | Industry Watch | Learning Curve | News | Products | Search | Substack
Copyright © Rixstep. All rights reserved.