Virtual hosts with MAMP on Leopard

Assumptions (Kind of major assumptions):

  • You are running Leopard (and therefore cannot use “Netinfo Manager” to edit your hosts).
  • You already have MAMP up and running and MAMP is using the Apache config file located here: /Applications/MAMP/conf/appache/httpd.conf
  1. Set up a directory for your dev website. I created: /Applications/MAMP/htdocs/csimmons
  2. Create a “host” for your site. In Leopard this will require you to edit the hosts file manually. Be sure to use sudo or you will not be able to save the file. Type the following and enter the root password when prompted:
    $ sudo pico /etc/hosts
    Add the following at the bottom

    # VIRTUAL HOST START
    127.0.0.1 csimmons.dev
    # VIRTUAL HOST STOP

    CTRL+O to write the file (then hit ENTER)
    CTRL+X to exit pico
  3. Flush the DNS cache
    $ dscacheutil -flushcache
  4. Edit the Apache config file:
    $ pico /Applications/MAMP/conf/apache/httpd.confChange the following:
    OLD:
    ServerName localhost:8888
    NEW:
    ServerName 127.0.0.1:8888

    Continue to the very bottom of the file (use CTRL+V to page down faster) and you will find “Section 3: Virtual Hosts”. Add the following at the very end:

    NameVirtualHost 127.0.0.1
    <virtualhost 127.0.0.1>
    DocumentRoot /Applications/MAMP/htdocs
    ServerName localhost
    </virtualhost>
    # DEVELOPMENT HOSTS START
    <virtualhost 127.0.0.1>
    DocumentRoot /Users/username/Sites/csimmons
    ServerName csimmons.dev
    </virtualhost>
    # DEVELOPMENT HOSTS STOP

    CTRL+O to write the file (then hit ENTER)
    CTRL+X to exit pico

  5. Restart the MAMP servers. I just click “Stop Servers” and then “Start Servers” on the MAMP widget.
  6. Try it out. Point your browser to the following (no www in the address and don’t forget the port[8888]): http://csimmons.dev:8888
  7. Rinse. Repeat for each of your dev sites. Multiple sites would look like this:

    hosts file:

    # VIRTUAL HOST START
    127.0.0.1 csimmons.dev
    127.0.0.1 site2.dev
    # VIRTUAL HOST STOP

    Apache config file:

    # DEVELOPMENT HOSTS START
    <virtualhost 127.0.0.1>
    DocumentRoot /Users/username/Sites/site2
    ServerName csimmons.dev
    </virtualhost>
    <virtualhost 127.0.0.1>
    DocumentRoot /Users/username/Sites/site2
    ServerName site2.dev
    </virtualhost>
    # DEVELOPMENT HOSTS STOP

Subversion on Ubuntu (Feisty) with a Mac Client

Subversion gets my ducks in a row

As part of a continuous effort to improve my organization (a.k.a. not lose stuff) I have finally set up Subversion at home. If you are not familiar with Subversion it is an open source version control system used (mostly) by developers to keep up with changes to their codebase.

I’ve spent most of my career as kind of a “one man team” where I have been responsible for all phases of development and maintenance of code. However, I was exposed to Subversion when I contracted briefly last year in a multi-developer environment. I made a mental note at that time to revisit Subversion at a later date.

At last that date has come…

Subversion is now running at home on an old Gateway pc that I recently “upgraded” from XP to Ubuntu. I’m a total newbie with Linux, but I’ll be posting some on it in the future. Thanks to this tutorial the process was ridiculously easy (less than 5 minutes).

The next step was to get an SVN client. My previous exposure to Subversion was in the Windows world so we used TortoiseSVN. I have a PowerBook and an iMac at home though so I hunted down scplugin which integrates with Mac Finder the way TortoiseSVN integrates with Windows Explorer.

Now I just have to get all my code checked in.

Boot Camp + XP SP1 Disc = :-(

I do some .NET work on a project where the developers all use Visual Studio. A few weeks ago I foolishly tried to install it onto Virtual PC on my Powerbook G4. Total no-go. The installation took hours and the program locked up indefinitely the first time I tried to run it.

So, I took the plunge last week and decided to load XP onto the new family iMac using Boot Camp. A slight (deal breaker) problem arose though as I was preparing for installation. I was disappointed to discover that the XP cd that came with our PC was SP1 and therefore not compatible with Boot Camp.

A few minutes of googling, however, revealed a process known as “slipstreaming” whereby you can download SP2, merge it with your SP1 files and burn the result to a new cd that will work with Boot Camp. At first glance the process seemed pretty involved, but ultimately it proved fairly simple to follow. Here is where I found it.

I did it one snag though…

The ultimate goal of the process is a bootable XP cd. The result of my slipstreaming, however, produced 722 MB of files, which is just barely too large to burn to cd (Note: the size of your slipstream depends on how much extra crap came on your SP1 cd). So, what could be trimmed from my project? I deleted the SBSI folder, which in it’s own words is:

“Microsoft (r) Windows XP Professional Step by Step Interactive is a multimedia, self-paced training product that uses a combination of simulations and informative topics to create an easy and flexible learning environment.”

Problem solved. Sliptream cd installed XP like a charm to the iMac.