views:

756

answers:

2

I've got a Mac that I can run either the Leopard (10.5) or Snow Leopard (10.6) version of OS X on. I'm using it to do web development/testing before publishing files to my production host.

On the production host my site's doc root is under the home directory (e.g. /home/stimulatingpixels/public_html) and I'd like to duplicate that location on the Mac. Unfortunately, their is a hidden and lock placeholder on the Mac that looks like a mounted drive with nothing in it sitting in the /home location.

I know from experience that it's unwise to move this and drop in your own /home directory because upgrades can cause it to be erased (and it doesn't get stored in the TimeMachine backup, by the way).

So, the question, is there anyway to safely use /home on a Mac either Leopard or Snow Leopard?

(Note: I realize this is very Mac specific and will be asking it in an Apple forum as well. Just wanted to ask here in addition to cover all the bases.)

Update: To help describe why I want to do this, in addition to the front end web site, I've got a series of scripts that I'd like to run as well. One of the main goals with being able to use the /home directory (and more specifically the same path from the servers root) is so that can use the same output paths on the development mac as well be used on the production server. I know there are ways to work around this, but I'd rather not have to deal with it. The real goal is to have all the files on the development Mac have the same filepath from the / root of the directory tree as the production server.

Another Update: The other reason that I forgot to mention earlier for this is setting up .htaccess paths when using basic authentication. Since those paths are from the file system root instead of the website docroot, they end up going through "/home" when that's part of the tree.

+3  A: 

Why don't you just run MAMP and use the Sites directory? You can develop off localhost and just have a bunch of aliases for your sites. I'm not sure why you specifically need to use the home directory.


EDIT: Ok, I think you are going about solving your problem the wrong way.

If it's HTML paths you are worried about, the begin everything with a slash "/" which will default it to the home dierectory.

If it's the references in your PHP, then you need to create a global (or similar) and set it as the root of your site. Then you can reference everything from the global and when you move the site from dev to production all you need to change is the global.

Trying in a round-about way to develop from /home because it looks more like the production server is a bad idea.

Install MAMP, create the global somewhere high in the hierarchy and start re-referencing. It'll be less pain in the long run.

Evernoob
The web server isn't the issue. I'm fine with running apache. What I'm really after is using the /home directory itself. The same questions would apply regardless of the server being used. I'll add a comment above, but the real reason is that I have some local script that I run and I'd like to be able to define the paths on my local dev box so they matches the ones on production. That way, I don't have to deal with changing them during deployment.
anotherAlan
Just use a symbolic link and let your local script think it's operating on the /home directory.
Matt Ball
But this is what using an environment like MAMP is for... So you can set up your dev environment however you like and the paths should be exactly the same. Are you using relative or exact paths?
Evernoob
Matt: Symbolic links won't work in this directory. For example, right now, I've got the docroot set to "/www/stimulatingpixels/", but if I do: "sudo ln -s /www/stimulatingpixels/ /home/stimulatingpixels" the response is: "ln: /home/stimulatingpixels: Operation not supported"Evernoob: I'm using exact paths, and that's really what I'm trying to work for. It's much less about the websever itself, but the ability to create a file at a location under the /home dir on the Mac that is the same as it will be on the production server. (Largely this is for other scripts outside the site itself.)
anotherAlan
Evernoob: It's really the Perl scripts that support the site that I'm focused on. As you mention, PHP stuff is not an issue. I use $_SERVER['DOCUMENT_ROOT'] to get to the website's docroot when necessary. What I'd like to be able to do is have supporting perl scripts (for example, one that hits an external site and creates an include file at a specific path) setup so the output paths are the same on dev and prod. I know there are ways to work around this, but I'm interested in seeing if there is a way that I don't have to. That way, I keep my dev and prod environments as similar as possible.
anotherAlan
+2  A: 

Found an answer to this one on the Apple forums.

(http://discussions.apple.com/thread.jspa?threadID=2073807&tstart=0)

In order to reclaim the /home directory, edit the /etc/auto_master file and comment out (or remove) the line with /home in it. You'll need to reboot after this for the change to take effect. This works with Max OS X 10.5 (Leopard). Your millage may vary on different versions, but it should be similar.

As noted on that forum post, you should also be aware that Time Machine automatically excludes the /home directory and does not back it up.

anotherAlan