Peter’s Mac OS X Notes

Peter’s Mac OS X Notes

This is a list of various unix projects I've installed under Mac OS X and any issues I have in making them work.


Environment Variables

Under Mac OS X, environment variables can be configured in three different places, and each one makes the variables available to different things:


This file is read in when you log in as a user under Mac OS X. All the variables are made available to any application or process you launch, which probably includes the Terminal and hence any shells you open directly. In particular, this would include applications like BBEdit and CodeWarrior which runs scripts (like perl and cvs) on your behalf.

This file is a plist and can be edited with the property editor, or manually, or it can be created magically from your existing environment via a script.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
<plist version="0.9">

Changes take effect at login, so you'll need to logout and log back in.

~/.cshrc or ~/.tcshrc

These files (only ever have one), are used by any tcsh shell you launch, including remotely accessed ones. Terminal launched ones probably pick up the environment.plist variables, but if you ssh into your Mac from another Mac, then probably not.

setenv PERL5LIB /Library/Perl:/Users/yourusername/perl
setenv CVSROOT yourusername@yourhost:/cvs
setenv CVS_RSH ssh
setenv LC_ALL C

crontab file

When you add cron jobs (using conrtab -e), they are neither run under your Mac OS X login nor under a tcsh shell, so you can also set envrionment variables in your crontab which will get used when executing cron actions.

12 1 * * * perl


exim is a mail server with some very nice features.


This is a little Perl script I wrote to compile simple expressions into exim expressions. Hopefully it'll be useful to someone. here are some examples:

if $message_age < 300 then 1 else 0

Result: ${if <{$message_age}{300}{1}{0}}

if    !def('sender_host_address')  then 0 else 1

Result: ${if !def:sender_host_address{0}{1}}

if    $header('X-Stairways-Local') eq 'yes'  then 0 else 1

Result: ${if eq{$header_X-Stairways-Local:}{yes}{0}{1}}

if (($message_age < 300) & (exists('/var/lock/MASTER'))) |
(!defheader('X-delayed') & !(exists('/var/lock/MASTER'))) then 1 else 0

Result: ${if or {{and {{<{$message_age}{300}}{exists{/var/lock/MASTER}}}}
   {and {{!def:header_X-delayed:}{!exists{/var/lock/MASTER}}}}}{1}{0}}

if    !def('sender_host_address') 
     | ($sender_host_address eq "") 
     | ($lc($header('X-Stairways-Local')) eq 'yes') then 0 else 1

Result: ${if or {{!def:sender_host_address}{eq{$sender_host_address}{}}



Not much testing (all the above run through exim -be, but whether they are correct I could not say!).

No documentation.

Available from here.