Understanding the OSX File/Directory Structure

Discussion in 'General Mac Discussion' started by superleccy, Dec 12, 2004.

  1. superleccy macrumors 6502a

    superleccy

    Joined:
    Oct 31, 2004
    Location:
    That there big London
    #1
    Hi there

    I got my first ever Mac a few weeks ago, and am gradually (and happily) making the switch from Windows.

    Can anyone give me any pointers on how the OS X file / directory structure hangs together?

    After over a decade of using Microsoft stuff, you get used to the fact that all your programs are probably in "Program Files", and the contents of your desktop is in a folder called "Desktop" in your "Windows" folder... and so on. On Windows systems this knowledge comes in handy when you're uninstalling stuff / removing viruses & spyware / fixing stuff / identifying redundant files / selecting files for backup.

    Okay, so I probably don't need to know this info for the Mac, but I have a strange desire to find out. I know it's based on UNIX, and yes I've already found the command window and had a look around. I used to use UNIX a lot several years ago but I'm pretty rusty now. So, is there a book or a reference on the web that someone can point me too?

    Also, what is the OSX equivalent of the Windows Registry?

    Many thanks in advance for any pointers.

    Regards
    Superleccy
     
  2. jholzner macrumors 65816

    jholzner

    Joined:
    Jul 24, 2002
    Location:
    Champaign, IL
    #2
    Well on a Mac all your applications are in the Applications folder and the desktop folder is located in your home directory under "desktop" Don't know much about the other stuff you asked.
     
  3. stoid macrumors 601

    stoid

    Joined:
    Feb 17, 2002
    Location:
    So long, and thanks for all the fish!
    #3
    There is no registry! ENJOY!! :cool:

    I once heard a computer science teacher explain that the Windows registry is one of the biggest programming flops in all of computer history. :D :eek:
     
  4. Doctor Q Administrator

    Doctor Q

    Staff Member

    Joined:
    Sep 19, 2002
    Location:
    Los Angeles
    #4
    Rather than a single monolithic registry, Mac OS X keeps information in plist files, which contain readable text in XML format. Just to pick a random example, open file System -> Library -> Preferences -> com.apple.SoftwareUpdate.plist in TextEdit and you can see how the O.S. keeps track of the last time you checked for a Software Update:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
    	<key>ChecksumURL</key>
    	<string>https://swquery.apple.com/WebObjects/SoftwareUpdatesServer.woa/wa/checksums</string>
    	<key>LastAttemptDate</key>
    	<date>2004-12-11T22:11:10Z</date>
    	<key>LastResultCode</key>
    	<integer>0</integer>
    	<key>LastSuccessfulDate</key>
    	<date>2004-12-11T22:11:10Z</date>
    </dict>
    </plist>
    When things go right, either plist files or a central registry work equally well and the user of the computer shouldn't much care how it works. But due to bugs in software, the Windows registry or a plist file can get corrupted, which makes it nice to have the files separate (and readable and editable) to contain the damage. For example, you can sometimes fix a problem with a given application by throwing away plist files belonging to that application, with no fear of endangering other applications.

    The operating system resides mainly in three folders: System and Library at the root of the boot drive, and the Library folder in the System folder. Feel free to explore in there. As long as you don't change the contents of files, you won't hurt anything by poking around.

    Two other folders at the root take care of the rest of the system:

    1. Applications. This folder holds the installed applications, and each application is actually a folder disguised as a single executable file. Control-click on an application and select "Show Package Contents" to see what's really in there.

    2. Users. This folder contains a home folder for each user, to keep YOUR files (and other users' files) separate from the operating system's files. Each user's home folder contains a Library folder too.

    At first having three types of folders named Library might seem odd, but it has a reason. It lets items such as fonts, preferences, caches, etc. be organized so that the items belonging to the operating system (e.g., builtin fonts) are in one place, the items belonging to all users (e.g., fonts that come with an application) are in another place, and items belonging to a specific user (e.g., fonts that you install just for your own use) are in yet other place.
     
  5. abhishekit macrumors 65816

    abhishekit

    Joined:
    Nov 6, 2003
    Location:
    akron , ohio
    #5
    In addition to storing the app under applications, there is a small preference files in your home/library/preferences.
    And for some applications you can find some additional support files in home/library/application support.
    So to delete most of the apps, you just have to trash the icon in applications folder, which actually is the full app.
    I don't know what is the windows registry and what does it do. So can't answer on that.
     
  6. superleccy thread starter macrumors 6502a

    superleccy

    Joined:
    Oct 31, 2004
    Location:
    That there big London
    #6
    Wow! Thank you DoctorQ and everyone for your responses. I've had a look around with Finder and with Terminal (where did I put my old copy of "UNIX in a nutshell"?), and it all seem pretty logical once you know how.

    It all seems like such a breath of fresh air after Windows. I didn't realise about applications really being "disguised executable folders", and about the concept of plist files. It explains why applications seem so much easier to install/uninstall. Nice to know too that installing an app won't scattergun your hard drive with junk.

    I now feel emotionally closer to my iBook. Thank you all.

    :D

    Regards
    Superleccy
     
  7. panphage macrumors 6502

    Joined:
    Jul 1, 2003
    #7
  8. Makosuke macrumors 603

    Joined:
    Aug 15, 2001
    Location:
    The Cool Part of CA, USA
    #8
    It's also perhaps interesting (though not useful for most people, and you may have already noticed this) to note that OSX also has all the standard UNIX directories on the boot drive: /usr, /bin, /Volumes, and the like. These are intentionally hidden by the Finder, but they do hold important parts of the OS, and there are a few hacks and tricks that can involve messing with their contents even if you're not a UNIX geek.

    Any file begining with a . (period) is also hidden by the finder, and some important low-level files are named this way. A good example would be the ".DS_Store" files; there is generally one in each directory, as they hold the information relating to the state of that window in in the finder (Icon or List view, icon arrangement, window size, etc), but are invisible under most circumstances.

    Worth noting as well that although /Applications is the standard place to install all applications, they need not be there. Almost any well-written OSX applicaton should run regardless of where it's located, and it can be moved at any time without breaking things. This can be handy if you like downloading shareware; you needn't even copy it off of the disk image it came on to test it--just give a double click and if you like it copy it later.

    On the other hand, OSX assumes that Apple's applications will be in either the Applications folder or the Utilities folder within, and though they should run fine from elsewhere, it will usually only update them properly (through Software Update or downloadable uptdaters) if they're in the "right" place.
     

Share This Page