3

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!

closed as too broad by M K, Mark, Lri, bmike Dec 13 '13 at 14:21

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    This question is very broad. Please edit it to be more specific. You can also look at apple.stackexchange.com/questions/105774/… - it covers a little bit of what you're asking. – M K Dec 12 '13 at 9:03
  • This is probably not an appropriate answer for OP, but for others who find this question on the web: If you're a programmer and you want to really understand how UNIX works I highly recommend APUE – kojiro Dec 13 '13 at 14:02
  • A big welcome to the site. To be honest, this is really too long and will likely get closed by the community. However, let's have you read a bit on the help center pages on how to ask a pointed question and see if you can find one or two of the most pressing things you don't get and ask them once you've thought a bit and narrowed the scope. As it stands, it's a shopping question for either a book or course and not really about a problem of the scope where Stack Exchange works well. – bmike Dec 13 '13 at 14:20
2

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

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.

  • Macports is definitely actively maintained – Mark Dec 12 '13 at 11:48
1

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.

1

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.

  • Just as an aside, the Mac GUI mounts disks under /Volumes automatically, no need to create anything. – SilverWolf Oct 17 '17 at 20:40
1

Considering you have previous knowledge and not afraid of command line. I would suggest start installing archlinux in a virtualbox, and play with it. The installation process will tell you a lot about Linux/Unix basic knowledge. The pacman and AUR will tell you about a nice package manager and community. Compared to the complexity of OS X, archlinux is easier for understanding linux/unix. I personally also find OS X package managers such as homebrew quite confusing and annoying and prefer the Arch Way.

I think the knowledge you gained playing with it will help you resolve OS X issues in the future.

Not the answer you're looking for? Browse other questions tagged .