Sei sulla pagina 1di 5

Unix:

Under the Mac OS X hood.


A beginner's guide.
By Citizen James
The original article can be found out at http://hearditonthe.newsvine.com/_news/
2006/05/27/229074-unix-under-the-mac-os-x-hood-a-beginners-guide
Copyright belongs to the original author, with the knowledge and thanks of Mac users everywhere.

Introduction

Mac OS X is built upon the rock solid UNIX Operating System. What this means in simple terms for
you, the new-to-Mac user, is that the world of open source, free software has never been more
accessible.

We're going to use a bit of software called Fink to get the ball rolling. Using Fink we're going to
download, compile and install some applications, including the KDE desktop environment, and run
them alongside Mac OS.

KDE is more readily associated with the Linux environment, but by compiling it's source code,
using Apple's developer tools, Fink can build KDE and run it inside an x11 window on your Mac OS
desktop.

Now that previous paragraph used some terms those of you really brand new to all this might want
to raise your hand and ask about. Those familiar can skip at this point, but in short..

• Apple Developer Tools can be downloaded for free from Apple.com. Fink uses the
compilers included in ADT to build applications and programs from their source code.
• x11 is, broadly speaking, a toolkit for building Graphic User Interfaces with, and all Unix
varients, such as Linux and Mac OS can use it, although in the case of the Mac Apple
developed their own windowing system, called Quartz, to display the OS X User Interface.
• Fink knows where to find the source code and components needed to build programs
because it is syncronised to a Concurrent Versioning System (CVS), which automates the
tracking of changes made to code by developers all over the world.
First things Fink.

After downloading and installing Fink you need to drag and drop "Fink Commander" into your
applications folder. Launch Fink commander and have a look around. Go into the preferences and
check the box marked 'Use unstable packages', in the 'Fink' tab of the preferences window. Quit
Fink Commander when you're done.

Now open a Terminal session. You'll find Terminal in


Macintosh HD > Applications > Utilities. While Fink can
be used with the Commander program I personally find it
easier to use the command line, and not just because
Commander can be a little buggy. The command line
gives much greater flexibility over how you use Fink, and
to the real beginner it provides a good opportunity to
familiarize one's self with a command line application.

In the terminal window you will see the name of your computer followed by the account username
you are logged in as. Something like: Apple-Macintosh:~ jamesgardner$. This is the command
prompt. You can change the way the terminal appears, including the size of the font, using the
preferences menu.

In the terminal type: fink selfupdate and hit Return. Fink will phone home to make sure it is using
the latest version of itself, and if need be download any updates. Once that's done type: fink list
xorg. 'List' is a command Fink uses to list the names of any packages from the CVS which match
your search word. So for example try typing fink list games. You should see a short list of packages
for the gnome and KDE environment which contain the word 'games' in their package name.

Back to xorg. Apple's X11 windowing system, which bundles with OS X Tiger, isn't always stable
when providing windows for certain applications. You don't need to worry too much about the why's
and wherefores, but removing it and replacing it with the official reference implementation of the X
Window System is preferable, so we'll make xorg's XDarwin the first application we compile using
Fink.

At the command line type: fink install xorg. Fink will ask you a bunch of questions for which you
shouldn't need to change from the default, so simply hit 'Return' on each option and wait for xorg to
begin downloading. Fink will fetch, build and install the necessary code so that, after a while, you
have a fully working binary of the XDarwin windowing system in your Applications folder. Once
xorg is installed you should use it instead of Apple's X11. Now, let's have a bash at installing an
environment which we can run some applications in.
Installing KDE.

A word to the wise, waiting for Fink to compile applications, especially ones as complex as an
entire desktop environment like KDE, takes a very long time. You will be leaving your computer
switched on working quite hard for at least one or two overnight sessions. If you have an older Mac
which barely meets minimum system requirements for running OS X Tiger, don't plan on turning it
off for a very long time.

KDE, as with all open source applications, is made up of thousands of lines of code "borrowed"
from hundreds of different packages. The packages upon which KDE is dependent can be
automatically installed by Fink. Fink will go out and find the source code for the programs which
comprise of the KDE base package and build them so that you have a working KDE environment.
After that is done you can add to the KDE suite at your leisure, again using Fink to go out and find
the packages you want to install.

At the terminal type: fink install bundle-kde-i18n. i18n is the international version of KDE which it is
recommended you use. Once Fink has asked you some questions, again for which you can
assume the default response for which will work just fine, KDE will begin compiling. The only times
at which the default response to Fink's questions might not work for you, is if a server which Fink is
trying to download from is off-line. At this point Fink will ask you if you want to choose a new mirror
or abandon your install. If you choose to find a new mirror Fink will pick up where it left off once it
finds a server which is available. If you choose to abandon your install, packages which have
already been successfully compiled and installed will not need to worked on again when you
resume your session.

Other occasions upon which you might need to re-start the compile process include times when
Fink throws so-called build-lock failures. Every now and then Fink can become confused and loose
track of which package it has already installed and which it still needs to work on. When Fink is
building a package it locks the file which holds the source code. If you try to begin a separate Fink
session in another Terminal window which attempts to build the same dependent package as
another Fink session, the package can not be unlocked, or removed automatically by Fink. In this
instance you should manually remove the package and build it again.

In these cases Fink is quite good at guessing what kind of command you might try using to solve
the build-lock problem and it will hint at this in the error log, displayed above the Terminal
command prompt, but occasionally you will need to refer to the Fink website's Frequently Asked
Questions for a particular package.
Other UNIX commands and getting KDE working.

When you launch XDarwin the default empty state X windows will draw on a gray background.
Pretty uninteresting. Changing the
preferences settings for XDarwin
so that it launches in a so-called
Rootless state will enable it to
draw the KDE widows over the top
of your Mac OS Desktop. But first
things first, we need to tell
XDarwin to launch KDE when a
new session begins. To do this you
need to launch a UNIX application
called pico, which is basically a
simple text file editor. Using pico
we're going to create a hidden
UNIX system file named .xinitrc to
instruct XDarwin how to launch
KDE.

At the terminal type: pico .xinitrc and hit 'Return'. Pico launches and creates a new file
named .xinitrc. In the pico window cut and paste this line of code:

source /sw/bin/init.sh
/sw/bin/startkde >/tmp/kde.log 2>&1

..and save the .xinitrc file by choosing CTRL and X to exit and choosing 'Yes' when pico asks you if
you want to save the changes you've made to the file.

Now, when you launch XDawin, it refers to the line in the code above which points to the startkde
program. After a second you'll see the KDE splash screen and KDE will begin loading the default
programs which display the 'K' menu and the control center, et cetera. Once KDE is launched you
will notice that even though your XDarwin preferences are set to show in Rootless, as opposed to
Fullscreen, KDE's background and icons still obscure your Mac OS X desktop.

In KDE open the Control Center by selecting it from the 'K' menu. Go to the desktop settings and in
the behavior tab deselect "Show icons on desktop", then click "Apply". You should now be able to
see the Mac OS X desktop as well as the 'K' menu and toolbar.
Known issues.

Running in Rootless mode occasionally conflicts with Exposé, Apple's animated window organizer
and desktop management tool. Large black squares, selectable as windows but which contain no
other UI elements, appear dotted around the place and the 'K' menu sticks open, even though it is
not selectable. The black box window bug doesn't appear to affect the functionality of any running
tasks and the sticky 'K' menu doesn't prevent the 'K' menu from re-opening properly.

KDE can also seem to hog the processor and spin up the Mac's fan due to over heating. As with all
things experimental (hence having to allow Fink to use unstable packages) it's recommended that
you back up and save any important information on your Mac before you begin playing around.

I hope this has been of some help towards getting people new to Mac OS X interested in having a
look under the hood. Here's some useful links and references for use with this article.

Potrebbero piacerti anche