I worked with a Mac last week for the first time ever. I noticed that the shell is very similar to Linux. I normally develop on a Windows machine and tend to be a noob at all things Linux. Will a Mac help me with this, or will it make things worse for me due to minor differences in Mac's OS?
5 Answers
It certainly won't make things worse. There are numerous similarities between OS X and Linux and if you're beginning to dabble with OS X, the minor differences won't be relevant right now. Things like the bash shell, scripting tools, and many Linux shell applications are all available for OS X.
I regularly develop on OS X on my MacBook and run my programs on a Linux workstation. There will be a point where you'll need to learn the differences between Linux and OS X (e.g. how services are managed) but by the time you get to that point, you'll know where to find the information you need.
-
2Couldn’t agree more. Getting a Powerbook (way back when) and OS X is what spurred my interest in Unix in general. After a few months of tooling around Terminal I was comfortable enough to start tooling around the terminal of a Linux machine, and then things kinda spun out of control from there and I became a huge *nix nerd...OS X is still my flavor of choice though.– peelmanNov 19, 2010 at 17:03
Certainly.
OS X is a POSIX compliant UNIX based OS built on top of the XNU kernel, that includes many standard Unix tools that can be explored from Terminal.app. Because of the POSIX compliance many programs written for Linux can be recompiled to run on it.
The Fink and MacPorts projects can help extend the toolsets you can learn with as well.
-
1With the caveat that the windowing system is completely different. If you're working purely with terminal programs, they'll work. If you're using a GUI, you need to worry about the X11 shell on top of everything.– TarkaNov 17, 2010 at 16:20
Linux will help you learn Linux. Linux may well help you learn Mac. I'm not sure Mac will help you learn Linux, though.
You're correct that there are many similarities between Mac OS X and Linux. This is because they're both based on Unix. There are major differences, however. Mac OS X is set up to be a consumer operating system. This means that all but the most detailed and fiddly tasks have a graphical interface that's nice and easy to use. Linux was originally designed as a hobby project and is now mainly used in servers. For normal desktop users Linux is getting better and better every day, but many more routine tasks simply assume you can use the terminal. Sometimes there isn't a GUI, or it isn't installed by default. Sometimes there is a GUI, but the instructions are out of date and still refer to the terminal, or the author just uses the terminal out of habit. Either way, going from Mac OS X to Linux will still leave you with a learning curve (as there is with any switch of operating system). It also depends on how much you want to learn about the depths of the operating system - if you're doing low level stuff like driver programming, they'll be very different. High-level programming will probably be very similar.
That said, there are many things that are the same. You've already noticed the shell - likely bash
, which is a common default - is the same. Similarly, many of the command-line utility programs like ssh
, rsync
, top
, ps
, grep
and the shell builtins to name but a few are the same or very similar. If you end up using the terminal a lot on Mac OS X, you'll feel right at home with the terminal on Linux.
I like Macs, and it does give a good (BSD) UNIX experience but strictly on getting a Linux experience on your PC, I feel there are better alternatives.
I personally use Cygwin on any Windows machine I own. You download the installer from http://www.cygwin.com/setup.exe The commands are basically the same GNU ones that Linux runs, so scripts should run fairly similar to Linux (the big difference tends to be paths, with spaces in filenames and $HOME directory path much more likely). There are also various utilities to help merge the UNIX/Windows experience, like cygpath, cygstart, etc.
You can also try running COLinux. An interesting port of the Linux kernel to run as a Windows process and interact with Windows cleanly. I've never tried it, but it looks promising. http://www.colinux.org/
If you just want to play with it a bit, you can always run from a LiveCD or a USB drive. If you just want to try it, LiveCD is fine, but if you want to do any real work you'd want a USB drive to be able to save and get updates.
And there's always dual boot, but that tends to be more difficult setting up on Windows versus Mac Bootcamp.
-
2Cygwin is really bash grafted onto Windows, which becomes all too apparent when you try to do unixy/bashy things to files not local to your current working directory. Windows paths and unix paths are barely on speaking terms. Bash is better than cmd.exe and Windows is better with Cygwin than without, but it's a bit of a rough-edged hybrid. I say this as a recovering Windows victim, moved to MacOS (and loving it and its unix), now with one foot back in Windows' camp courtesy of my current employer.– JRobertNov 16, 2010 at 22:40
-
I see your point, but since you have the ability to add a huge chunk of the UNIX toolkit, and it uses UNIX paths for these, you can still do a big chunk of UNIX things in cygwin. Granted, it does break down if you try to do Windows'y things. Our workloads differ obviously, i find it incredibly useful. Nov 17, 2010 at 19:48
-
I don't dispute your experience with it and I continue to use it myself. But I find it confusing near the boundary between the two and thinking that a linux learner would find it even moreso.– JRobertNov 19, 2010 at 18:02
I would have to say yes, but not completely. And that yes depends on how frequently you use the Mac's command line (Terminal). For various things, I've come to use the command line often and see the similarities between the BSD base of OSX and Linux. So much so that I've also come to refer to Macs as "linux done right" (please don't flame, I have good reasons! (for me)), speaking from a power/ease-of-use point of view. Sure, there are some big differences between the two (app installation, for example) but on the low level, you can get a good, basic understanding of linux via frequent use of the Mac's Terminal application.
Of course, to master linux you will need to use it regularly; and from my personal experience I would guess that mastering linux, like anything else, can take years of use, tinkering and learning.
cp
,top
, ...) have different command-line switches, I think because Mac OS X uses the BSD versions.