In Depth: The Linux users' guide to Mac OS X: "
Linux is fantastic, don't get us wrong, but Apple's kit can also be appealing – especially its range of Apple laptops. But if the thought of getting to know OS X puts you off, fear not: there's a lot of common ground between Mac and Linux that isn't immediately obvious.
For starters, you may already know that under the hood Mac OS X is BSD Unix-based. This means you can fire up a terminal window and get your fingers into the operating system via the command line in much the same way that you can with Linux.
There's also an increasing amount of Linux software ported to Mac. We've taken a look into some of the similarities and differences between Macs and Linux to help if you're thinking of becoming a multi-OS household.
Getting started with OS X
Fire up a Mac OS X machine, take a look at the desktop and, aside from the layer of gloss, the first differences you're likely to notice coming from a Linux environment are the Dock and the menu bar.
Let's deal with the latter first – you see, instead of the OS having a menu bar for system tasks and each application having its own individual bar within its window, in OS X there's a single menu bar at the top of the screen that alternates between the two. The right-hand side of the bar contains the date, information on your battery (where applicable), a wireless button, and various other configurable options.
Meanwhile, the left-hand side holds the application menu of whichever program has your focus, or Finder if none has. As you move between programs, this menu bar will change accordingly. The Apple menu, accessed via the little Apple logo on the far left, has a basic list of system operations and information.
For more of these options, you need to open Finder, which enables you to navigate through files and your computer.
Great minds think alike
The Spotlight tool on the far-right – the magnifying glass icon – enables you to search both filenames and the contents of files for anything you want, which makes it roughly equivalent to Beagle on Linux.
Finally, there's the Dock at the bottom (by default), where you can shove a selection of frequently used apps, files and directories for easy access. You can also set it to hide itself automatically so it's not in the way, which is particularly useful if you're on a laptop with more limited screen space.
FINDER: The Mac desktop with a Finder window open, the Dock at the bottom and the all-purpose menu bar at the top of the screen
If you try this out and like it, or like the idea and want to give it a go on Linux, there are a few Dock-a-likes available. Avant Window Navigator is probably the most popular, but there are other options available as well.
Applications
Applications in OS X are handled pretty differently to Linux
By default, they're kept in the /Applications directory, but you can place them anywhere you like, because each application is an appname.app directory that masquerades as a single file in Finder. If you want to look inside that directory, you'll need to go to the Terminal, type cd/Applications/appname.app and take it from there.
WEBKIT: Apple's Safari browser uses WebKit, a HTML engine based on the KDE project's own KHTML
The idea is that OS X applications should all be self-contained: all the application data is kept in that one file, rather than being scattered in various places about the system. However, there is some app-related data that's kept elsewhere: there's /Library/ for system-wide information and ~/Library for individual data.
In essence, if it's something that a user might want to change – themes, plugins and so on – then you'll find it in one of the Library locations. You can also get at the contents of the app folder using the Show Package Contents option in the right-click (or Ctrl+click if you're using a single-button mouse) context menu.
Starting up daemons is no more complicated than it is in Linux, but the process is slightly different. Some can be started from the appropriate System Preferences tab, or alternatively there's StartupItems and launchd. Most Unixlike daemons can be run via one of these, but they work differently, so you'll need to rewrite (or find) appropriate start scripts. In theory, you should use StartupItems in OS X 10.3 or earlier and launchd for 10.4 onwards, but launchd can be fussy, so you might have to mix the two.
If you're running Fink or MacPorts, your downloaded apps and packages live in either /sw or /opt/local, respectively. The setup process for each should add the appropriate bin directories to your $PATH, and this all works much the same as in Linux. Check your $PATH setup with the command echo $PATH if you have trouble using any Fink or MacPorts apps.
The command line
So far there's been more that's different than in common between our two OSes, but the similarities become much clearer as soon as you open up the Terminal program found in /Applications/Utilities. Type ls and you'll see a directory listing, just as you'd expect.
TERMINAL: OS X's Terminal looks pretty much like any other console
Entering pwd will reveal that your home directory is at /Users/username/ rather than /home/username, but that's just a cosmetic difference, especially since ~ refers to the home directory and cd with no argument will return you to it. Try echo $SHELL to show that Bash is your default shell. Which works too, along with the standard shell built-ins and other basic CLI commands.
Locate is also present, but note that to update the database, you'll need to run /usr/libexec/locate.updatedb. You'll need to do this as root and using sudo, because there's no separate root account on a Mac. You can set one up in the Accounts tab of the System Preferences application, which also enables you to set various other system config options.
You won't need it all that often, though – often sudo will do just fine. If you're yearning to know more, man pages are available exactly as they are on a Linux system. This can be particularly useful, because some BSD commands don't work in quite the same way as Linux commands.
For example, grep on OS X doesn't have the --exclude-dir option, which is a nuisance. The Alt+. Bash shortcut to enter the final argument from the previous command line doesn't work on OS X, either, so you'll have to use Esc+. instead.
In general, however, Ctrl does what you'd expect it to on the command line, so you can still use Ctrl+A and Ctrl+E to jump to the start or end of a line. However, this can be slightly confusing given that in graphical apps, the Apple key takes the place of the Ctrl key on Linux. So, for instance, you'd use Apple+W rather than Ctrl+W to close a window.
This is probably to do with the fact that Terminal is more Unix-like than the Aqua environment that lives on top of it and handles all the graphical jobs. When it comes to using X11, which is available for Mac and runs well in OS X 10.5, you'll just have to experiment a bit.
One final neat feature of Terminal is the open command. Type open filename and OS X will fire up the graphical program that's the default handler for that type of file, which saves a lot of time looking for the correct applications.
GUIs and eye candy
You knew it was coming, so here it is: OS X is exceptionally pretty. One of the features that delights Mac users is Exposé, which enables you to hit a button (or move the mouse to a specified part of the screen) and have all your open windows shown at once. There are clones available for Linux, such as Komposé, Skippy and a Compiz Fusion plugin called Scale, which may be worth investigating if you find yourself missing the power of Exposé on your Linux box.
SHINY UI: Exposé makes picking an app from those you have active easy. It's handy if you're often flipping between tasks
However, they're still not quite as shiny. Some people find the Mac OS X Aqua look and feel is particularly attractive too. You can get Aqua-style themes for Gnome, although the extent to which these make it look like a Mac is a matter of debate.
A really neat GUI trick in Macs is the ability to preview files from Finder. Select the file, hit the Spacebar and a little window pops up with a preview of the file. You can then scroll through the directory, or return to the normal file listing.
Filesystems
The preferred filesystem in OS X is HFS Plus. This has Unix-style file permissions, journalling and extensive file metadata. By default, it's case insensitive but case preserving, although you can choose to format drives to be case sensitive instead.
The default settings can cause problems if you're bringing files over from Linux, because ext2 and ext3 are case sensitive. It's particularly troublesome if you have files that share the same name and are only differentiated by case. OS X can handle the various FAT filesystems and NTFS, but sadly won't deal with ext2 or ext3.
Samba, baby
However, what does work well is NFS and Samba mounting. You should know, though, that as a BSD-based system OS X will use a port numbered above 1024, whereas Linux NFS expects clients to use a privileged network port, which will be less than 1024. There are two ways of solving this.
The first is to add the insecure parameter to the /etc/exports file on the server:
/local 10.1.0.* rw,insecure
If you prefer, and you have only one or two Macs on your network, you could do this to open the access only for those machines in particular:
/local 10.1.0.17 rw,insecure
/local 10.1.0.* rw
The other option is to fix it at the client end, which is probably neater if you're the only one using the Mac. To do this, add -P to the command line via the Terminal.
mount -P server:/local /mnt
The other feature of Mac OS X that's worth mentioning while we're discussing filesystems is Time Machine – the archive and backup system built straight into OS X 10.5 (Leopard). This works like Bacula or any other similar incremental system, backing up changes as often as you define.
However, the advantage of the program over similar offerings is that it's plug and play – once you've set up an external drive as your backup destination, Time Machine will automatically kick off whenever you plug it in. Not only that but the program will then carry on with the scheduled backups until the drive is full or unplugged.
It's probably possible to cobble together something to do this on Linux (using udev and Bacula or a similar incremental system), but on a Mac it's just there, ready and waiting. In short, Time Machine is absolutely fantastic for the backup-obsessed and a great way to help anyone who isn't make sure their backups happen on a regular basis anyway.
Since Apple started using Intel processors, it's become more feasible than ever to run OS X on non-Apple hardware. Head on over to www.osx86project.org and you'll find a community who are working on doing just that. If you want to join them, be prepared for a fair amount of hacking, though: OS X out of the box only provides drivers for Apple hardware.
The Kalyway install disk fixes this, but you'll probably still need to mess with the BIOS settings. Note that OS X is not free software, so you'll need a licence to run it. On the flip side, you've been able to run Linux on Mac hardware for ages – there's a PowerPC port of Debian, for example – but it's even easier now that Intel chips are in use.
You should be able to boot a live CD without any hacking – so it's easy to give it a go, or to use this once in a while if you just want to run a few Linux apps or check something out. Finally, there's the virtual machine option. Again, if you want to run OS X inside a virtual machine on a Linux box, you'll need to pay for a licence. However, running Linux inside a Mac on a virtual machine is straightforward and painless.
Somefink special
Given that most Linux software is portable to Mac, though, there seems little need to bother with running a distro in a virtual machine. Since OS X is POSIX-compliant, meaning it conforms to the POSIX standards set by the IEEE to define Unix compatibility, software written for Linux or BSD can be easily recompiled to run on a Mac.
From our point of view, this means that we have access to a far bigger stack of software than just the programs natively released for Mac, even though that's an increasingly large quantity of software itself.
There are two major projects that aim to make this process easier: Fink and MacPorts. Both aim to provide OS X ports of pieces of open source software, in particular those that come from the Unix world. They're also fairly easy to use once installed.
However, each one has its issues, and the chances are that you'll be a little further behind the trend than if you were installing the software from a Linux repository. In other words, the Fink stable package will be an older one than the package you'd find on, say, Fedora.
In terms of the differences between the two, Fink has a GUI available and can be used from the Terminal, whereas MacPorts is Terminal-only. In addition, MacPorts is built by Mac employees, which may make it slightly more reliable, and it tends to be a little more up to date. We recommend that you pick one and stick with it, because although they can run side by side, you're more likely to run into problems that way.
Making the most of Macs
As we've seen, there are a lot of similarities between Macs and Linux once you get into the OS a bit, which stems from OS X's BSD heritage. This means that it's straightforward to run both Macs and Linux boxes on your network and to switch regularly between the two. For laptops in particular, the 'it just works' factor of Macs is fairly compelling.
There's also some great software available for Mac that isn't available elsewhere, especially graphical and music-making apps, but using it doesn't mean you have to skimp on using Unix programs. The downside is that Mac hardware is costly and the OS isn't free.
You probably don't want to shift over to Mac altogether, but it's well worth investigating a little, or at the least looking into some of the neat Linux software inspired by Mac design options.
Related Stories
"
(Via TechRadar: All latest feeds.)
No comments:
Post a Comment