Changes the document root of a virtual host.
wwwhome [--vhost HOSTNAME] [PATH]
Set the base document root directory for your virtual hosts by adding the following to your shell profile:
Set document root for virtual host "USERNAME.localhost" to current directory:
Set document root for virtual host "USERNAME.localhost" to directory "~/Development/myproject":
$ wwwhome ~/Development/myproject
Set document root for virtual host "ruby.localhost" to current directory:
$ wwwhome --vhost ruby.localhost
wwwhome symlinks the document root of any virtual host to your current directory.
It aided me for years in developing web apps locally with a single local domain, e.g.
Set the base document root of your virtual hosts by setting the environment
WWWHOME_ROOT in your shell profile:
If your username is
johndoe and you have a virtual host running at
johndoe.localhost with the document root set to
/usr/local/var/www/johndoe.localhost, you can change into the directory of your web project
project-a and run
$ cd ~/Development/project-a $ wwwhome Symlinked '/usr/local/var/www/johndoe.localhost' to '/Users/johndoe/Development/project-a'
Your virtual host will now serve project-a.
Change to another project:
$ cd ~/Development/project-b $ wwwhome Symlinked '/usr/local/var/www/johndoe.localhost' to '/Users/johndoe/Development/project-b'
Your virtual host will now serve project-b.
The default virtual host domain is
$(whoami).localhost. You can either set the environment variable
WWWHOME_DEFAULT_VHOST to change the default virtual host domain:
Or pass the option
--vhost to wwwhome to use another virtual host:
$ cd ~/Development/project-b $ wwwhome --vhost ruby.localhost Symlinked '/usr/local/var/www/ruby.localhost' to '/Users/johndoe/Development/project-b'
wwwhome does know nothing about your actual virtual host configuration. It merely appends the vhost name to the
If you name your actual document root differently from the local domain name, just use the directory name of your virtual host for
$ cd ~/Development/project-b $ wwwhome --vhost whatever Symlinked '/usr/local/var/www/whatever' to '/Users/johndoe/Development/project-b'
Multiple development domains
If you have more than one virtual host domain, say one for PHP (
php.localhost) and one for Ruby development (
ruby.localhost), your can create an alias for the other domain(s) in your shell profile:
# Create an alias for setting the ruby.localhost virtual host alias rbhome="/usr/local/bin/wwwhome --vhost ruby.localhost"
rbhome will always set the document root for
$ cd ~/Development/railsapp $ rbhome Symlinked '/usr/local/var/www/ruby.localhost' to '/Users/johndoe/Development/railsapp'
will copy the
wwwhome script to
will symlink the
wwwhome script from
will remove the
wwwhome script from