How to get to know OS X/Unix better? [closed]

Not sure how to ask this but this problem has troubled me for so long.

I'd long been a DOS/Windows user until about 12 years ago when Mac OS X first came out I turned to the Mac, and stayed here ever since. I'm 32 so I basically grew up using text-based/command-line UI, starting from DOS 3.1 when 3.5" floppy disks weren't even supported. So I'm pretty comfortable using command line UI no problem. But the thing is, since I came to OS X, I've never really understood how this OS works.

Like say on DOS or early Windows OSes. I know there's autoexec.bat and config.sys where I can make changes to so to make the computer do what I want it do to at startup. And I know all the basic functions are stored in some directory called "Command" where I can find most of what I need to move around the OS. The file system is pretty straight forward. Each disk has a name, A, B, C, D, E and so on and so forth which appear to be at the top level of the file system, which makes sense to me as everything basically stored in these hardwares. And I also know if say I'm at certain directory but I need to use some function that's not in this directory, I can put the directory of that function into "PATH" so that I can use it wherever I want.

But on the Mac (and same on Linux. I've tried it quite a few times but sort of got stuck in the same place), I don't how to do any of these. Not that I need to do something like this everyday, since we have the all might GUI, but when I need it it's really a big problem for me. For example sometimes I need to install something that requires some command line knowledge, like Octave. After some research I know I need to use something called package manager like Fink, Macport or Homebrew. If they can just work out of the box I wouldn't be here asking this. The problem is very often they don't. They almost always get stuck in somewhere during the install. And there is also always some essential knowledge I don't know, like I can choose among the three but I can't use any two of them at the same time as my package manager or something might go wrong. OK, something might go wrong...how would I know that before something really goes wrong? Why is this case? Why can't I use both at the same time? When I install them, where do they put the binaries? Will Homebrew put the directory into the default path so I can use it whenever I want by itself? During install when there's warning or error, should I just ignore it?

The first time I tried to install Octave on my mac I actually tried all three without knowing I can't use all three at the same time. But what else could I do after seeing both Fink and Macport failed the job. And the last time I tried to install Octave it literately took me three days. Because at that I've already learned I couldn't use all three and also I should use Homebrew because it's the one that worked before. So it took me 3 days to do some ad-hoc research on the internet with no success, and then I thought I might just give Fink a try again, and it worked! I just don't understand any of this... And I should consider myself lucky that I even got it to work, because so far I still haven't found a way to install numpy to my Python 3. And don't know how long it had taken me now...

It's the same as when I used to want to try using Linux. I know a little bit of coding. Although I mainly use Python, I still have a bit of knowledge of languages like C/C#. So I know what compiling means. The problem with Linux (and mac too), is when I want to install something, often times I need to compile the binaries from the source code first. And a lot of things can go wrong during the process of compiling (to which I don't know why). And this is not something searching on the internet can help me cuz most of the answers provided on the internet are ad-hoc based. They tell you you should try this command or that command and see if that works. Sometimes it does, sometimes it doesn't. But the problem is even if it works and solves the problem, I still don't know why it works. At this point I still don't know, say when I've finally finished compiling the source code, where is the binary? Is the binary I get the actually application or it's just an installer? If it's an installer, how do I install it? Where do I install it to? And things might go wrong during the installation as well. As I said earlier, resorting to the internet doesn't really help in this case cuz even if I've got it to work this time, next time when something similar happens, I still have to go through the whole internet-research thing again. It's really time-consuming and frustrating, cuz you don't know what you're doing and you feel like you're Sisyphus trying to get the rock to the top of the mountain over and over again just to see it rolls down once again...

So my question is this:

Is there any book or online course that can help me get to the bottom of this? Compared with spending another 100 hours on searching on the internet and still get stuck in the same place I rather spend that 100 hours (and I would assume it'd be far less than this) to build some firm foundation for my understanding of any Unix like system.

It's a long article so thank you so much for reading it!


Apple offers a free shell script primer which you can access here:

  • HTML

  • PDF

Those are both free.

There's also Learning Unix for OS X ($12 ebook)

I definitely recommend Homebrew as it seems to be the most actively maintained of the 3 variants.


This is the book I used to get comfortable with Unix: http://www.amazon.com/Mac-OS-Tiger-Unix-Geeks-ebook/dp/B0043EWTXK/ref=sr_1_2?ie=UTF8&qid=1386847146&sr=8-2&keywords=mac+os+unix+geek

It is really well written but has a lot of 10.4 things that have changed or been modified slightly. I am sure you could find cheap copies of it though. TJ's points are also fantastic and highly recommend them as well. Lots of great online resources for getting familiar with Unix.


UNIX filesystem hierarchy doesn't use MS-DOS/Windows type "Drive Letters", rather all filesystems fall under / (the very top level).

A UNIX machine can have multiple disks and/or partitions, but only one if them is mounted as /. The rest are mounted somewhere under / (either at that level or some lower level).

For example, say I have 4 hard disks and want to use them all:

Disk 1: mounted at / Disk 2: mounted at /extra-disks (must create empty directory /extra-disks first) Disk 3: mounted at /extra-disks/music (must create empty directory /extra-disks/music first) Disk 4: mounted at /extra-disks/database (again, must create it first)

Or, I could split the operating system installation itself like this:

Disk 1: / Disk 2: /usr Disk 3: /usr/local Disk 4: /var

To temporarily put a directory in the search path of a user, open a terminal and type:

export PATH=$PATH:/extra-disks/database

There are also ways to do this permanently, depending on the shell you are using. If your shell is bash, then you can edit your .bash_profile and add / edit the export command mentioned above. This will make the change permanent, starting with the next login.