Welcome to the private homepage of Stephan Klimek. Mainly this a place to publish articles of my current interests, to host some of my software projects in development and to provide some personal stuff. This site was developed using the excellent dokuwiki framework. For further info you can have a look at the Inprint page and use this Contact form for any feedback or requests.

Wiki Index

Setting Up Your OS X

Original sources of informationAll the hacks listed are updated for MacOS version 10.3. Updates are always available via my weblog, in the bow for me I am root category.

Partition your hard drive

Currently, my hard drive has three partitions: One with a minimal size of 10 Gb for the OSX installation (which I named “XSpace”, a tribute to one of Apple's

http://www.lightbulb.com/tools/mcf/index.html Fink projects, one 2Gb (minimal 500Mb) partition for the http://fink.sourceforge.net Unix ports manager, and the rest of the disk space allocated for a Users partition.

Since 10.2 I stopped using the Classic environment. I found I never really used it, and why live in the past, anyway? If you do use Classic, it is a good idea to create another partition for your OS9 installation (make it as small as possible, perhaps just 300Mb). Why? Well, for starters, these are really two different kinds of operating system. So, as a consequence, it seems more tidy to keep the file directories separate. Another reason is that you can put disk maintenance stuff on both partitions and occasionally check and repair the other partition.

If you have a spacious disk but very little RAM, you might even consider setting aside a reasonable sized partition (2Gb) to hold the swapfile (virtual memory).

The major advantage of the above partition scheme is that you can have the various partitions on removable drives to transport to other machines. It also makes for easy backup, since you would be backing up only the personal files. Yet another good reason, is that with the customizable folders on different partitions, you can easily reinstall OS X if necessary on the OSX partition, while leaving the rest intact.

Install OS X

Just a bit of CD shoving and mouse-clicking. Make sure to install the http://developer.apple.com/tools/ Developer Tools as well. You can get it from Apple's website, if it was not included with your OS X copy. To get this package, you need to become a member of Apple's Developer Connection. This is, fortunately, free. To do so, go to http://connect.apple.com apple/connect and subscribe. Soon you are subscribed, log in to the same page, click on “Download Software”, then on “Mac OS X”, which will finally enable you to download “Mac OS X Developer Tools”.

Enable root

This is not really necessary. After all, you can really just do a “sudo bash” or “sudo tcsh”. If you really want a root user, go to the Terminal, and type

$ sudo passwd root

After that, you can do a “su” and be root for any time. The usual warnings and disclaimers apply here…

Move the swapfile (if required)

If you have a separate partition dedicated to the OSX's swapfile, you need to tell OSX to use that. The way OSX loads the swapfiles has changed dramatically from 10.1 to 10.2 and may be different in 10.3. I suggest looking up the appropriate method on http://www.macosxhints.com/search.php?query=swapfile&keyType=all&datestart=&dateend=&topic=0&type=stories&mode=search MacOSXHints.com.

Move the Users/ directory

I use fstab to mount my Users partitions into /Users. Previously, I used symbolic links, but found that symbolic links are not recognized by the Installer, which can mess up system upgrades. If you already have stuff in your old Users directory, use the ditto command to copy them over.

$ sudo ditto -v -rsrcFork /path**to**foo /new**path**to_foo

The command ditto copies source directories to a destination directory, thereby preserving resource forks, owner, mode, and groups. (thanks to “foamy” from this tip!). Warning: do not forget to pass the parameter -rsrcFork to ditto or you will fail to copy resource forks and hence may make quite a few files useless.

Do a sudo vi /etc/fstab and add a line that mounts the Users partition right into /Users :

LABEL=Users /Users hfs rw 1 2

Please note that the /Users directory must exist, otherwise the system will not mount the partitions in those mount points. Since the /Users directory is in use while you attempt to move around stuff, it is best to reboot in single user mode (press command-S during startup). Follow the instructions that appear at the prompt and then:

$ cd /
$ mv Users Users-old
$ mkdir Users
$ chmod 775 Users

After the next restart, if mounts were done properly, you may wish to remove the old directories. Also, it is a good idea to load fstab into the NetInfo database:

$ sudo niload -m fstab / < /etc/fstab

<strong>Alternative option for moving the Users folder</strong> Open the NetInfo Manager application. Select the user to edit from the “users” directory in the main window. In the bottom pane, the property-value pairs for the selected users will be displayed. At the bottom, the property “home” is shown with value ”/Users/username”. Replace this with ”/Volumes/Users/username”. This is a decent solution, but quite inefficient if you have more than one user, and gives you two Users directories on the drive.

Set up command line printing

In 10.2 and 10.3, CUPS is installed and nothing is needed to set up command line printing. To get access to the CUPS online printing management page, just go to http://127.0.0.1:631/ http://127.0.0.1:631/. If you are using 10.1, a lot more work needs to be done:

This solution has been suggested by Alex Levine and works smoothly. The step-by-step instructions below assume you are root and that your ethernet connected laserprinter is comfortably called “Leezer”.

In the file /etc/printcap, create the following entry

Leezer: :lp=:rm=Leezer.dot.org:rp=lp:sd=/var/spool/lpd/Leezer: \
lf=/var/log/Leezer-errs:

and then run the commands:

$ sudo tcsh
god-mode: cd /var/spool/lpd/
god-mode: mkdir Leezer
god-mode: chown root.daemon Leezer
god-mode: cd Leezer/
god-mode: touch .seq
god-mode: chown root.daemon .seq
god-mode: cd /var/log
god-mode: touch Leezer-errs
god-mode: chown root.daemon Leezer-errs
god-mode: chmod 644 Leezer-errs
god-mode: niload printcap / &lt; /etc/printcap

Finally, go to the Print Center, and add the printer you just created, by selecting “Leezer” from the Directory Services panel. That's it. Now you can do:

$ lpr -PLeezer file.ps
$ lpq -PLeezer
no entries

Note that lpc does not work properly under OSX. Ignore it.

Install X11

In 10.2 and 10.3, I recommend installing Apple's own http://www.kung-foo.tv/blog/archives/000339.php www.xfree.org X11. If you prefer XFree86, go to http://www.xfree.org/ xfree. Download everything and just follow the instructions in the INSTALL file. That's really all there is to it. This package also installs an application in your OS X's Application folder with the rather clever name “XDarwin”. Click on this file and it will launch the XWindows window manager.

One note: With XDarwin you can select the keymapping to use for your system. However, some keys may not be mapped properly. For example, on my Japanese keyboard the arrow keys are not mapped. http://www.ab.wakwak.com/~tino/darwin/ xmodmap.txt offers a solution. In the XDarwin preferences, select the US Keymapping file and then add the following line to your .xinitrc (located in your home directory): xmodmap $HOME/.Xmodmap. Get a xmodmap.txt file, rename it to .Xmodmap and put it in your home directory. This works perfectly for the japanese JIS keyboards, but for other keyboards, you might need to modify the modmap file yourself.

Install the Fink package manager

X11 as it is, is rather boring. Now that we have a pure UNIX interface with the FreeBSD layer, we obviously want to do much more with it. Fortunately, that doesn't require much work. http://fink.sourceforge.net/ Fink ” title=“Add more UNIX!!! is an attempt to bring the full world of Unix Open Source software to Darwin and Mac OS X. Think of it as an add-on distribution (in the Linux sense) for these systems. Read the README and the FAQ, then download and install the Fink binary. Make sure you set up the CVS as well (the how-to is on the Fink website), so you can easily update with new packages.

By default, Fink installs itself and any package into the directory /sw. This may seem strange, but there are very good reasons for it, as explained on the http://fink.sourceforge.net Fink homepage. In my case, I have chosen to have fink install in a different partition: /Volumes/GNU/ .

After installing fink, all you have to do is a simple:

$ fink install &lt;package-name&gt;

and Fink installs the appropriate ported Unix package. I installed a2ps, ghostscript, gimp, gnupg, gnuplot, grace, gv, rxvt, scilab, tetex, xemacs, and so on. Of course, you can also use Fink to install XFree86.

If you want or need to port UNIX apps to Darwin manually, then please read the http://fink.sourceforge.net/doc/porting/index.php Porting Tips first.

Modify the 'ls' command to enable colors

First of all, use http://fink.sourceforge.net Fink to install the GNU file-utils ([fink install fileutils] will do). Then either edit your .cshrc or your .bash-profile file to create an alias for ls with colors, e.g. (Use man ls to find out what the flags do)

(for tcsh) alias lc 'ls -GAhlk --color=always'
(for bash) alias ls="ls -AF --color=always"

Obviously, you want to have your own set of color settings. Here's the how-to in tcsh for 10.2 (for more info see http://www.macosxhints.com/article.php?story=20031027145026892) macosxhints.com:

$ dircolors -p > ~/defcol.txt
$ vi defcol.txt      #edit to your heart's contents
$ dircolors defcol.txt &gt; ~/Library/init/tcsh/environment.mine

Setup SMTP

For 10.3 follow http://www.kung-foo.tv/blog/archives/000652.php these instructions on my weblog. For 10.2, see http://www.kung-foo.tv/blog/archives/000193.php this weblog entry.

For 10.1, do this:

First, you have to edit /etc/hostconfig to add a valid hostname instead of -AUTOMATIC-, otherwise sendmail cannot use an address to send mail. This hostname is supposed to be the valid DNS entry of your Mac. So, if your Mac only has an IP-address and no DNS name, it will be difficult to set up for SMTP. Also change the line MAILSERVER=-NO- to MAILSERVER=-YES-.

Sendmail is very strict to prevent users from being able to access files they would normally not be able to read and will check modes and file permissions on relevant directories. As such, the following comands have to be executed:

$ chmod go-w / /etc /etc/mail /usr /var /var/spool /var/spool/mqueue
$ chown root / /etc /etc/mail /usr /var /var/spool /var/spool/mqueue

Unfortunately /System/Library/StartupItems/Sendmail is not configured properly. You can manually start the Sendmail command in this directory, but it will fail to start up during boot processes. The reason seems to be that sendmail performs a test and sends output to stderr or stdout or waits for input. Both of these file streams have, however, not been opened yet. So, just put sendmail in the background by adding an ampersand after the command.

Therefore, open the Sendmail script and modify the line: /usr/sbin/sendmail -bd -q1h into /usr/sbin/sendmail -bd -q1h &.

Also edit StartupParameters.plist to replace the word Preference by OrderPreference.

You can start sending mail after the next reboot, or after a manual start of the Sendmail script. To verify if it works, send an email and do a tail -f /var/log/mail.log. To send mail quickly:

  • use the mail command: Type in mail you@wherever.com and press Return
  • after the Subject: prompt, type a title, e.g. Testing sendmail, and press Return
  • type a message such as Your tip works/does not work and press the key combo Control+D

Setup a POP3 mail server

For 10.3, follow the instructions in http://www.kung-foo.tv/blog/archives/000654.php my weblog entry. For 10.1 and 10.2, do the following:

Eric Belsley from the http://www.macresource.com/ qpopper MacResource site provides info on setting up a POP3 server. It is a very easy procedure. Eudora provides free POP software at their http://www.eudora.com/qpopper/ site. Download and compile. I found that the make install command did not work, so I became root and manually moved the executable “popper” to the /usr/libexec directory and the man pages to /usr/share/man/man8/. You also have to edit /etc/inetd.conf to uncomment the pop3 line, and change /usr/local/libexec/popper to /usr/libexec/popper qpopper -s. Finally, all that is left is to kill -HUP the inetd process. The guide that comes with qpopper is very detailed. It contains one error in that it mentions mail being in /usr/mail, but instead, it locates at /var/mail. The guide also implies that that it is important that one should make a symbolic link, /var/spool/mail, that points to /var/mail. I did that, but did not verify if it was really necessary.

If you want to set up an IMAP server instead, then you most likely will benefit from this http://www.stepwise.com/Articles/Workbench/eart.2.0.html link at stepwise.com!

Set up anonymous FTP

You can find a good setup script on http://www.bmannconsulting.com/node/view/58 Boris Mann's site. It has been modified recently, although it has not been tested on 10.3.

Multiple icon sizes

This is a bloody clever hack that enables you to have different icon sizes in your windows for pre-10.1. Find it at http://www.resexcellence.com/hackhtml01/05-23-01.shtml weblog entry. Unfortunately, this hack does not work in 10.1 anymore… BUT: it is back in 10.2! To find out how, go to my http://www.kung-foo.tv/blog/archives/000466.php blog. Not tested in 10.3!

Some Handy stuff

Here's my .cshrc file for 10.2:

source /usr/share/tcsh/examples/rc
source /Volumes/GNU/sw/bin/init.csh
 
unsetenv LANG
setenv TERM vt100
 
bindkey -k down history-search-forward
bindkey -k up history-search-backward
 
set prompt = "\! %{\033[33m%}%n%{\033[0m%}@%{\033[31m%}%m% \
{\033[0m%}%{\033[36m%}[%c3]%{\033[0m%}: "
 
set path = ($path ~/bin /Developer/Tools /usr/local/bin /Library/MySQL/bin)
setenv MANPATH /usr/local/man:$MANPATH
 
set histdup = erase
set history = 1000
set savehist = ($history merge)
 
  - to turn off command suggestions
if ($?correct) unset correct
 
alias rm        'rm -i'
alias foo       'fink selfupdate; fink update-all'
alias sw        'cd /Volumes/GNU/sw/'
alias m         'more'
alias l         'ls -AFhl --color=always'
alias ls        'ls -AF --color=always'
alias setx      'setenv DISPLAY :0.0'
alias dict      'curl dict://dict.org/d:\!*'
alias dsrm      'find . -name ".DS_Store" -exec rm \{} \;'
alias today     'cat /usr/share/calendar/* | grep `date +"%m/%d"`'

For 10.3, I use the default bash shell. The corresponding ~/.bash_profile looks like this:

source /Volumes/GNU/bin/init.sh
export PATH=$PATH:/Library/MySQL/bin:/Users/adriaant/bin:/Developer/Tools
 
export PS1="\[\e[0;33m\]\u\[\e[0m\]@\[\e[0;32m\][\w]\[\e[0m\]: "
 
LS_COLORS='no=00;32:fi=00:di=00;34:ln=01;36:pi=04;33:so=01;35:bd=33; \
04:cd=33;04:or=31;01:ex=00;32:*.rtf=00;33:*.txt=00;33:*.html=00; \
33:*.doc=00;33:*.pdf=00;33:*.ps=00;33:*.sit=00;31:*.hqx=00; \
31:*.bin=00;31:*.tar=00;31:*.tgz=00;31:*.arj=00;31:*.taz=00; \
31:*.lzh=00;31:*.zip=00;31:*.z=00;31:*.Z=00;31:*.gz=00; \
31:*.deb=00;31:*.dmg=00;36:*.jpg=00;35:*.gif=00;35:*.bmp=00; \
35:*.ppm=00;35:*.tga=00;35:*.xbm=00;35:*.xpm=00;35:*.tif=00; \
35:*.mpg=00;37:*.avi=00;37:*.gl=00;37:*.dl=00;37:*.mov=00; \
37:*.mp3=00;35:'export LS_COLORS;
 
shopt -s histappend
export HISTCONTROL=ignoredups
export HISTIGNORE="&:ls:rm *:[bf]g:exit:l:more *:m *:history::cd:..:pine:foo:fink*:top:clear"
export HISTFILESIZE=2000
export HISTSIZE=2000
export SAVEHIST=4000
 
alias rm='rm -i'
alias srm='srm -i'
alias m=more
alias ..="cd .."
alias sw='cd /Volumes/GNU'
alias foo="fink selfupdate; fink update-all"
alias l="ls -AFhl --color=always"
alias ls="ls -AF --color=always"
alias setx='setenv DISPLAY :0.0'
alias dsrm='find . -name ".DS_Store" -exec rm \{} \;'
alias today='cat /usr/share/calendar/* | grep `date +"%m/%d"`'
alias start_cpan='perl -MCPAN -e shell'
wiki/osx/setting_up_your_osx.txt · Last modified: 2006-11-21 21:04 by admin
init24.de = chi`s home Mac OS X Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Valid CSS Valid XHTML 1.0 Recent changes RSS feed