Paul Ruffle at Starry Night
tools apps links time machine disk images x11 ssh parallels tools cron .bashrc postfix apache php/mysql/ssi virtual hosts

Paul Ruffle's OS X Hints and Tips

Open Quotes Unfortunately, although OS X gives you Unix under the hood, you don't necessarily get a fully functioning Unix environment in the same way that you do from a standard Linux install. So these are my hints and tips for getting the full monty on your Mac. It's a combination of various configuration settings and the installation of additional open source utilities. A few of the tips only apply to older versions of OS X, but most are relevant to OS X Mountain Lion. I also list various software tools, utilities and applications that I find particularly useful. If you are interested in using Fortran functions in your C/C++ programmes, see my notes on Calling Fortran functions from C, which is on the Xgear web site. Close Quotes

Paul Ruffle

Tools and Utilities

XCode Developer Tools
In order to build applications from source code, you need compilers like g95, so install "XcodeTools.mpkg", which you should find in the "Xcode Tools" folder on your installation DVD or download via the App Store.

If you are building X11 applications like XEphem, you need to install the X11SDK package, which will be on your installation DVD. It should get installed with XCode Developer Tools, but you may need to check.

Carbon Copy Cloner allows you to make a bootable backup or clone of your hard drive (including the Recovery HD partition since OS X Lion), as well as scheduled and synchronised backups of your data.

Fink brings Unix open source software to OS X (includes Fink Commander GUI). Good for Mac versions of xephem, xemacs, wget, ghostscript, gv and so much more. Indispensable really.

eps2png eps2gif eps2jpg converts files from EPS format (Encapsulated PostScript) to PNG (Portable Network Graphics), JPEG or GIF formats. It is a perl script that uses Ghostscript to produce the images.

ps2pdf - work-alike for nearly all the functionality (but not the user interface) of Adobe's Acrobat Distiller product: it converts PostScript files to Portable Document Format (PDF) files (not the same as pstopdf) and is part of Ghostscript.

Remote Buddy enables you to use your Apple remote to control applications such as PowerPoint, Keynote, NeoOffice, Adobe Reader or Preview.

Make Symlink makes proper symbolic links from the contextual menu (not free, but a non-registered version gives the basic functionality).

TinkerTool gets at all sorts of hidden settings.

HandBrake is an open-source, GPL-licensed, multiplatform, multithreaded DVD to MPEG-4 converter.

ffmpegX is a GUI designed to easily operate more than 20 powerful Unix open-source video and audio processing tools.

Audacity is free, open source software for recording and editing sounds.

RecoverTrasher is a small Applescript application that automatically removes the recovered files folder that Tiger dumps into the trash can.


iWork consists of Pages for the creation of documents, Numbers for the creation of spreadsheets and Keynote for the creation of presentations. Unlike Word, Excel and PowerPoint they let you do what you want, and for a lot less money! However, I still like Excel, but it was originally written for the Mac!

BBEdit is the best Mac editor in the known Universe, but it's not free!

Aquamacs is an Aqua-native build of the powerful Emacs text editor.

NeoOffice is an Aqua version of OpenOffice.

Parallels Desktop for Mac enables you to run Windows or Linux virtual machines on an Intel based Mac without rebooting. It even allows shared folders under Linux.

CentOS is a free and open source Linux distribution based on Red Hat Enterprise Linux. It installs easily under Parallels Desktop, and Parallels Tools work properly (see install note oposite).

XEphem is a scientific-grade interactive astronomical ephemeris software package, used by many professional astronomers.

Fugu is a graphical frontend to SFTP and supports SCP file transfers (free license).

Fetch is an easy-to-use FTP and SFTP client (free license to educational institutions).

MacTeX distribution from TUG contains the complete TeX Live 2007 distribution of TeX, Ghostscript, ImageMagick, as well as TeXShop, LaTeXiT, BibDesk and Excalibur.

TeXShop is a TeX previewer for OS X, that uses "pdftex" and "pdflatex" rather than "tex" and "latex" to typeset.

Excalibur is free spell checker designed for LaTeX documents.

Flip4Mac allows you to play, import, and export Windows Media video and audio files on your Mac using QuickTime.

PHP Apache Module is a PHP module for the Apache web server included in OS X. However, Apple has included PHP 5 since Leopard (10.5), and it can be enabled by editing httpd.conf (more).

MySQL can be installed on 10.4.x or newer using a binary package instead of the binary tarball distribution (more).
Download MySQL Community Server
Other MySQL Downloads

phpMyAdmin is an excellent and easy to use free software tool written in PHP for handling the administration of local or remote MySQL databases via your web browser.

Useful Links


GNU MAC OS X Public Archive.

OS X Hints

Apple - OS X - Downloads

Apple - Downloads - UNIX & Open Source

Learn How to Use OSX on LearnStuff.

OS X Mountain Lion - Issues

I have upgraded my MacBook Pro to OS X Mountain Lion (10.8) and have had to deal with a number of annoying issues:

Connecting to a Network via VPN

This no longer works properly (specifically Mail can't send or receive and Safari stalls loading pages). The fix is to find the relevant VPN certificate in Keychain Access and in the Access Control panel select "Allow all applications to access this item". Do this without any connection to the network in question, otherwise Keychain Access stalls too.

Apache Web Server and PHP/MySQL

If like me you run this on your Mac to test web sites you maintain, there are a number of irritating fixes you will need to make.

1. The option to stop and start your Apache web server has disappeared from System Preferences > Sharing. You will have to resort to typing one of the following from the command line:

    sudo apachectl start
    sudo apachectl stop
    sudo apachectl restart

To make my life easier I added these alias commands to my .bashrc file:

    alias startweb='sudo apachectl start'
    alias stopweb='sudo apachectl stop'
    alias restartweb='sudo apachectl restart'

2. Your Apache configuration file (/etc/apache2/httpd.conf) will be renamed and a new bland httpd.conf put in its place. My old httpd.conf file would not load for some reason, so I had to edit the new version with my configuration changes (see Apache Notes below).

3. If you use PHP, your configuration file (/etc/php.ini) will be renamed. Renaming it back to php.ini worked fine.

4. Once points 2 and 3 above were fixed, MySQL and phpMyAdmin worked fine.

Configuration and Settings

Reclaiming a Time Machine Volume's Disk Space

This excellent tip comes from Hawk iMedia and I summarise the key steps below. Before you start go to Time Machine Preferences and turn Time Machine off (obviously turn it on again when you have finished). Apple provides a command line utility named tmutil. It can do a lot of things, but there are two commands relevant to reclaiming Time Machine disk space. The first simply lists all your backup sets:

    tmutil listbackups

This lists the paths to all your backup sets in the sparse bundle Time Machine uses for your Mac's backups. Deleting a backup set is simple, but requires root privileges, e.g.

    sudo tmutil delete '/Volumes/Time Machine Backups/

This is just one long command and obviously you will use one of the paths to your backup sets as listed by tmutil listbackups. You will be asked for your administrator password and then tmutil will chug away. You can delete multiple backups in one go using wildcards:

    sudo tmutil delete '/Volumes/Time Machine Backups/

Note the use of single quotes because there are spaces in the path, but the wildcard * is not within the quotes. The above example would delete all backups in December 2011 (it will take a while to complete - if you choose to delete a whole year's backups, it might take hours, depending on the size of your backups).

Using the tmutil delete command only removes the backup from the sparse bundle, but it does not actually free any disk space. To free disk space use the hdiutil command, but first you need to identify where your Time Machine .sparsebundle file is mounted in /Volumes. In a Finder Window under SHARED or DEVICES (bottom left) click on the device or drive that Time Machine uses for backups. This will list one folder that contains your .sparsebundle file(s). Note the name of the folder, as this is what you need to look for in /Volumes (we will call it Data in this example).

    cd /Volumes
    sudo ls -l Data/

This will list several files including one (or more) .sparsebundle file(s). If there is more than one .sparsebundle file (because you are backing up several Macs to the drive) the one you want will have your Mac's name in the filename, e.g. YourMac.sparsebundle. Now you can use the hdiutil command (with sudo to gain root privileges):

    sudo hdiutil compact /Volumes/Data/YourMac.sparsebundle

If all goes well, hdiutil will tell you how much disk space you have reclaimed. If hdiutil complains about not finding your .sparsebundle file, go to a Finder Window and eject and then remount the device or drive that Time Machine uses for backups.

Burning ISO Disk Images

By default OS X burns a CD/DVD formatted as an HFS+/UDF hybrid (UDF supplanted ISO9660). However, if you want to burn an ISO9660 disk image to CD (or DVD) that can be read by any system (especially older versions of Windows), first make a disk image with Disk Utility (the default settings will be fine with a size to suit), then mount the image and copy whatever files you want to the disk image (you can change the volume name at this point too). Then unmount the disk image, open a terminal and use Apple's command line utility for working with disk images hdiutil:

    hdiutil makehybrid -iso -joliet -o cd-image.iso cd-image.dmg

This will create an ISO/Joliet .iso disk image file that you can burn to disk with Disk Utility. In fact you can do a lot more with hdiutil. Type man hdiutil in a terminal to get the full documentation. Here are a couple of useful examples:

Create a disk image from a folder:

    hdiutil create cd-image.dmg -srcfolder /path/to/folder/

Burn an ISO to CD (or DVD):

    hdiutil burn cd-image.iso

X11 Server

You need an X11 server running in the background, in order to run any open source applications that use the X11 Windows environment (like OpenOffice). If X11 is not already installed in your Applications/Utilities folder, install from "Optional Installs" on your installation DVD. From OS X Leopard (10.5) onwards X11 automatically starts the first time it is needed. If you are running Tiger add X11 to your System Preferences > Accounts > Login Items (see X-windows on OS X by William Scott).

Terminal or Xterm?

Now that OS X automatically starts X11 the first time it is needed, you can use the Mac's own Terminal which is easy to configure and use. However, Tiger users may still need to use xterm, so edit the xterm command in your .xinitrc file and in the Customize Menu in X11:

    xterm -b 5 -bd red -cr blue -geometry 90x25 
          -fa Monaco -fs 11 -sb -sl 1000 -T $USER@$HOSTNAME &

The Customize Menu in X11 does not need the trailing &, and you can define different size terminals by changing the -geometry and -fs options. Most of the other options are self explanatory, use 'man term' for those you don't understand. If you do not have an .xinitrc file in your home directory, copy the default file /etc/X11/xinit/xinitrc to $HOME/.xinitrc.

X11 Forwarding

If you want to forward/receive X11 sessions to/from another host via SSH, check that you have "X11Forwarding yes" in the files /etc/sshd_config and /etc/ssh_config respectively.

Transparent yellow X11 cursor on Intel Macs

Tiger users may have noticed that when running some X11 applications from a Linux server, but viewing the application's session windows on your Intel Mac, the cursor becomes a transparent yellow outline. There is a fix at OS X Hints, but note that it is for Intel Macs only.

SSH using RSA protocol version 2

To automatically login to a regularly used host you can create an RSA key pair by running ssh-keygen on your Mac:

    ssh-keygen -t rsa -f identity

(where identity could be your name or other identifyer)

Store the private key in $HOME/.ssh/identity
Store the public key in $HOME/.ssh/

Then copy to $HOME/.ssh/authorized_keys on the remote host (i.e. append the contents of to the file authorized_keys).

Then run SSH as:

    ssh -i $HOME/.ssh/identity user@remotehost

or set up an alias to make life even easier:

    alias logmein="ssh -i $HOME/.ssh/identity user@remotehost"

You will then never have to type a password for that host, but make sure your system is secure first!

This is really useful for remote rsync (see below) backup shell scripts like:

    rsync -avr -e "ssh -i $HOME/.ssh/identity" 
          user@remotehost:somedir/ $HOME/bkup/somedir

(the above is typed as one single rsync command).

Parallels Tools under Linux

To install Parallels Tools in CentOS under Parallels Desktop, you need to be logged in as root, so open a terminal window in CentOS and use the su command to do this:

    su root

and enter the root password. Now unmount the current disk image:

    umount /dev/hdb

Create a folder named Parallels Tools in the /media/ folder (this folder will serve as a mount point - note the backslash that escapes the space character):

    mkdir /media/Parallels\ Tools

To mount the image enter:

    mount -o exec /dev/hdb /media/Parallels\ Tools

Change the directory to the CD/DVD-ROM directory using:

    cd /media/Parallels\ Tools/

In the CD/DVD-ROM directory, enter the following to launch Parallels Tools installation:


and follow the on-screen prompts to install Parallels Tools. After this you should be able to share your Mac folders within CentOS, and have seamless mouse integration between the two systems.

For Fedora Linux use this to mount the image:

    mount -o exec /dev/sr0 /media/Parallels\ Tools

However, under Fedora 11 the tools don't actually work (as of September 2009). Hopefully the Parallels folk will fix this.


Your crontab resides in /var/cron/tabs/username, and this is an example of an entry that runs an rsync backup at 4:30 am every day:

# min   hour  mday  month wday  command
  30    4     *     *     *     /Users/username/bin/rsyncmymac

Also add/edit crontab for full paths, etc.


(Put an editable copy of your crontab somewhere like $HOME/Documents/myconfigs/username.cron).

Load your crontab with:

    cd $HOME/Documents/myconfigs
    crontab username.cron

List your current crontab with:

    crontab -l

Remove your current crontab with:

    crontab -r

Finally, don't forget to set System Preferences > Energy Saver to:

Put computer to sleep > Never

(you can put display and hard disc to sleep).

Note: cron can't run if the computer is asleep (or shutdown!) BUT see next item!

Backup to an External Drives

Unattended backup of files to an external drive may be a problem, as since 10.3.4 external drives unmount themselves when all users have logged out. Fortunately, Dantz documented a solution on their support site:

"When backing up to a file backup set on an external hard drive under OS X 10.3, users may notice an error -43 (file/folder not found) referring to the backup set catalog when the backup is run during a time when all users are logged out. This problem occurs because mac os X 10.3 unmounts all non-boot, non-ide drives when no users are logged in.

The following unsupported workaround should cause OS X to not unmount the volumes. As root, create the following file:


The file should contain the following:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" 
    <plist version="1.0">

Then, reboot the system. Volumes should now stay mounted regardless of whether a user is logged in."


Updating the locate database:

    sudo /usr/libexec/locate.updatedb

or add to your crontab:

    0 1 * * * root /usr/libexec/locate.updatedb


When I last checked, OS X appears to ignore any .login or .profile scripts in your home directory.


Paths should look something like this:


but, for example, fink asks you to add:

    . /sw/bin/

to the end of your .bashrc so that it can add fink's paths to your path settings. However, to avoid adding these paths more than once (which tends to happen because .bashrc gets called at login and then again each time you start a terminal) do the following (the actual extra paths are up to you):

if test -z "$MYPATHS" ; then
    export PATH=.:$HOME/bin:/usr/local/bin:$PATH
    export MANPATH=$MANPATH:/usr/share/man:/usr/local/man
    export INFOPATH=$INFOPATH:/usr/local/info
    . /sw/bin/                           # for fink
    export MYPATHS=true

Also make sure there are no "echo" commands in these login scripts. Such user friendly interactive output can completely screw SFTP connections to your Mac (see

To get a prompt that tells who and where you are
(e.g. username@mymac:~/bin>) add:

    export PS1="\u@\h:\w> "


Some useful alias commands to add to your .bashrc:

    alias ssh="ssh -X"
    alias md="mkdir -p"
    alias rd="rmdir"
    alias df="df -h"
    alias mv="mv -i"
    alias slink="ln -s"
    alias sed='sed -E'
    alias l='ls -1'
    alias la='ls -lhAF'
    alias ll='ls -lhF'
    alias lt="ls -lhtrF"
    alias l.="ls -lhtrdF .*"
    alias dir="lt"
    alias dot="l."
    alias cd..="cd .."
    alias cd...="cd ../.."
    alias cd....="cd ../../.."
    alias ..="cd .."
    alias ...="cd ../.."
    alias ....="cd ../../.."


Enable postfix for outbound relay of mail from the command line or via PHP. This has worked for me under Mountain Lion (10.8.2) on a MacBook Pro and Leopard (10.5.8) on a G5 iMac. This excellent tip from /usr: Enabling postfix for outbound relay on OS X Lion gives a blow by blow account of what you have to do, but don't put < and > around machinename, username and password. It uses Gmail as an example SMTP server, so just substitute the SMTP server you use. Here are the steps with the Gmail references removed (for safety make a backup copy of each file before you change it, adding .orig to the filename).

Step 1: Update the launchd configuration

Edit org.postfix.master.plist in /System/Library/LaunchDaemons/ to read as follows:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" 
<plist version="1.0">

Step 2: Edit the /etc/postfix/ file

Edit /etc/postfix/ by adding the following lines at end of the file, changing to your SMTP server name:

# Set the relayhost to your SMTP server
relayhost = []:587

# Postfix 2.2 uses the generic(5) address mapping to replace
# local fantasy email addresses by valid Internet addresses.
# This mapping happens ONLY when mail leaves the machine;
# not when you send mail between users on  the same machine.
smtp_generic_maps = hash:/etc/postfix/generic
# These settings (along with the relayhost setting above)
# will make postfix relay all outbound non-local email via
# your SMTP server using an authenticated TLS/SASL session.
smtp_sasl_security_options = noanonymous

# SSL certificate verification
smtp_tls_CAfile = /System/Library/OpenSSL/certs/cert.pem

Step 3: Edit the /etc/postfix/aliases file

Find this line in the file:

#root:		you
change "you" to your username (enter whoami in a terminal to get your local username) and remove "#" from the beginning of the line. Then run the newaliases command:
    sudo newaliases

Step 4: Edit the /etc/postfix/generic file

Add the following lines at the end of the file substituting your local username and machinename (enter hostname in a terminal to get your machinename), and your real email address (many SMTP servers, including Apple's iCloud, will only accept email if the From: address in the email matches the user's real email address):

# Translate my primary email address to my real email address
# This is ONLY for outbound email, and does not apply to local email.

Then run the postmap command:

    sudo postmap generic

Step 5: Edit/Create the /etc/postfix/sasl/passwd file

Store your SMTP authentication (user ID and password), so that postfix can connect as an SMTP client via an authenticated session. If the directory /etc/postfix/sasl does not exist prior to this step then create it:

    sudo mkdir -p /etc/postfix/sasl
    cd /etc/postfix/sasl

Create the following passwd file in /etc/postfix/sasl, replacing with your SMTP server name, username with the ID you use for your SMTP server and the password you use to login to the SMTP server.

[]:587    username:password

Then run the postmap command:

    sudo postmap passwd

Final Step: Test the settings

Test your settings from the terminal:

    # reload org.postfix.master.plist
    cd /System/Library/LaunchDaemons
    sudo launchctl unload -w org.postfix.master.plist
    sudo launchctl load -w org.postfix.master.plist

    # Just to be safe move to your home directory

    # Send an email to yourself on your local machine
    # (hit Control-D on a new line to end email)
    mail username
    # Check whether the email has arrived (hit 'q' to quit)

    # Send an email externally to your real email address
    mail youremailaddress

After the first email test above, check your local email in /var/mail/username. After the second email test above, check your real email account for the test email. If it has arrived, then you have a good configuration. If not check /var/log/mail.log for error messages:

    tail -f /var/log/mail.log

SSL certificate verification

Depending on the SMTP server you use, you might have to provide valid certificate authority (CA) certificates to OpenSSL via postfix. If you get an error message in /var/log/mail.log saying "Untrusted TLS connection ..." run the following:

    sudo security find-certificate -a -p 
        /System/Library/Keychains/SystemRootCertificates.keychain > 

(this is just one long command - my system would not let me write to /System/Library/OpenSSL/certs, so I created cert.pem in my home directory and then moved it to /System/Library/OpenSSL/certs). Then add the following at the end of your /etc/postfix/ file (you have already done this if you have followed the steps above):

    smtp_tls_CAfile = /System/Library/OpenSSL/certs/cert.pem

I found this information at Mac OS X Hints: Send mail from Terminal using mail/sendmail.

If postfix does not appear to be working, check the mail file /var/mail/username to see if your command line or PHP email has bounced rather than been sent to your intended recipient.


Your Mac's main web site (yourhostname.local) is in /Library/WebServer/Documents and your personal web site (yourhostname.local/~username) is in /Users/username/Sites (you can change these directories to symbolic links to elsewhere if you like).

Apache HTTP Server Version 2.2 Manual:

Browse yourhostname.local/manual/ or

Restarting Apache after configuration changes:

Check Web Sharing: On or Off in System Preferences > Sharing.

Running PHP under Apache

Apple has included PHP 5 since Leopard (10.5), so you don't need to install it separately. Enable it by uncommenting the line

    LoadModule php5_module    libexec/apache2/
in /etc/apache2/httpd.conf. You can also implement a php.ini file in /etc if you want to overide any of PHP's default behavior (start with the template file /etc/php.ini.default). In particular you might want to fix a warning appearing in phpinfo() by uncommenting date.timezone and inserting your time zone, e.g.
    date.timezone = "Europe/London"

Using MySQL with PHP under Apache

Download the appropriate MySQL package for OS X (32 or 64 bit depending on your system). Install everything in the package in this order: MySQL, MySQL Startup Item, MySQL Pref Pane. Start MySQL in the Preference Pane. Test that it's working:

(type exit to quit the MySQL monitor).

Fix mysql.sock location in php.ini. In /etc/php.ini, replace the three occurences of /var/mysql/mysql.sock with /tmp/mysql.sock.

Thanks to Jérôme Jaglale for PHP/MySQL tips.

Server Side Include (SSI) Configuration:

Apache's configuration file is /etc/apache2/httpd.conf (or /etc/httpd/httpd.conf for Apache 1 under Tiger), but edit with care!

The following link gives the pertinent configuration instructions:

I would recommend using the following settings:

mod_include must be installed and enabled (it usually is).

Also change the second instance of AllowOverride to All so that .htaccess works

    AllowOverride All

The following directives must be in the httpd.conf file or in .htaccess in the root directory or appropriate sub-directories of the site you want to allow SSI:

    Options Includes

Set the XBitHack directive:

    XBitHack on

XBitHack tells Apache to parse files for SSI directives if they have the execute bit set.

In fact it would be better to set:

    XBitHack Full

as this tells Apache to determine the last modified date by looking only at the date of the originally requested file, ignoring the modification date of any included files (useful for SSI that add a page's last modified date to the page).

Alternatively you can use the filename extension .shtml to tell Apache to parse files for SSI directives. To do this make sure that these two lines are uncommented in httpd.conf:

    AddType text/html .shtml
    AddOutputFilter INCLUDES .shtml

You also need to ensure that the various permutations of index.* are specified so that all home pages are seen by Apache:

    <IfModule mod_dir.c>
        DirectoryIndex index.html index.htm index.shtml index.php

You should also have a personal configuration file in /etc/httpd/users/username.conf if you intend to use your personal web site:

    <Directory "/Users/username/Sites/">
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        Allow from all

You can control access to a site by using this in the appropriate directory's .htaccess file:

    AuthType Basic
    # name that appears in Login window
    AuthName "Sitename Administrator"
    # apache password file (you have to set this up)
    AuthUserFile /usr/local/apache/passwd/passwords
    # username(s) from password file that can login
    Require user username
    # deny first!
    Order Deny,Allow
    # stop everyone
    Deny from all
    # then allow chosen domains or IP addresses
    Allow from domainname

See for how to create password file.

Enabling Virtual Hosts

Here's how to setup multiple sites on your Mac, with "root relative" calls for graphics, scripts, CSS, links, etc. and keep all of the files for any particular site together - and they don't even have to be in the default web server document root. The practice is called "Name-Based Virtual Hosts" as described in Apache's documentation.

First, use NetInfo Manager (Applications/Utilities) to create a pointer to localhost, to tell Apache what files to serve as the web site:

Open NetInfo Manager and browse to /machines/localhost.
Click on the lock, and enter your password so that you can make changes.
Duplicate "localhost" (Edit > Duplicate).
Select "localhost copy" and then select the name property in the lower window.
Change the value of "name" from localhost to whatever your development site will be, e.g. (don't use a real domain name, as it won't work).
Click on one of the other directories in the list, and you will be asked if you want to save your changes. Save them!

You've now made an extra entry in your NetInfo Manager for a test site that points to your local machine. However, if you try to go to with your web browser, you'll just see your Mac's main web site at http://localhost.

The second step is to create a VirtualHost entry in your Apache config file /etc/httpd/httpd.conf, using your test site's server name and an appropriate path to the location of the test site's files (you can set the site's options as well):

        DocumentRoot /Library/WebServer/Documents
        ServerName localhost    
        DocumentRoot /Users/username/webdev/
        <Directory "/Users/username/webdev/">
            Options Indexes FollowSymLinks MultiViews Includes
            AllowOverride None
            Order allow,deny
            Allow from all

Note that your Mac's main web site "localhost" must be defined first. You can create as many additional virtual hosts as you like.

Source text for Enabling Virtual Hosts by Bob Davis.

Home > OS X > Return to Top

Copyright © 2006-2013 Paul Ruffle. All Rights Reserved. Last updated 9 February 2013.