These last few days I’ve been trying to get XAMPP to work on my MacBook Pro these last couple of days and it has been frustrating! It seemed I kept running into more and more problems. For those who don’t know, XAMPP is tool for developers to run a LAMP stack (Linux, Apache, MySQL, PHP) on your machine locally. I’ve been running it on my Windows machines for years, and I have been running my production servers on Linux.
Installing just XAMPP and getting it to run with the Control Panel was easy. All my headaches started when I tried to get my vhosts installed and working. The problem I ran into getting XAMPP to run on my MacBook Pro were the following:
- XAMPP for Mac is different from XAMPP for Windows
- Max OS X comes with a Version of Apache Installed
- Mac OS X has additional permissions that are different from Linux
XAMPP for Mac != XAMPP for Windows
My first mistake was that I assumed that XAMPP for Mac is the same as XAMPP for Windows. After digging into it, the file structure and config files are pretty different. The php.ini file is different, and all the binary files are in /xampp/xamppfiles/bin/. On windows the binary files are in their own folders. It took me awhile to figure out where everything was at. This led me into my next problem:
Mac OS X comes with a Version of Apache Installed
When I was trying to debug why stuff wasn’t working, I opened up the terminal and started running commands. There is just one problem, OS X already has a version of Apache installed. So when I cd’d into the bin directory, I would execute this command:
apachectrl -t -D DUMP_VHOSTS
There was just one problem, it was executing the apachectl that was installed by Mac OS X, not the one for XAMPP. So it all my debugging with the config files, etc. wasn’t working. I was going insane. Finally I figured out what was going on and I had to execute this command instead:
./apachectl -t -D DUMP_VHOSTS
It started behaving like I expected! This lead my to my third hang up.
Mac OS X has additional permissions that are different from Linux
This threw me for a loop to. I don’t understand exactly why this was happening, but I kept gettinga Permission Denied when trying to view the vhost I was trying to setup. The way I used to do it on Windows is I have a partition for all of my development files. I would have a folder at the root of that drive called SVN_Repositories that holds all the SVN Repositories I use for work. So on my MacBook Pro at / I did the same, I had my SVN_Repositories folder. So my vhost would point to a directory like with a name something like this: “/SVN_Repositories/ExampleRepo/trunk/httpdocs/”
So my linux side clicked in and thought “Hrm, it looks like there is something wrong with the permissions. Let me change the folder permissions to 777 just to test.” So I did that and it still didn’t work. This it made me think it still was a vhost configuration issue. So I spent hours testing all sorts of stuff and just getting more frustrating. Then I read somewhere that XAMPP can have problems with OS X’s unique permissions on addition to the FreeBSD stuff it does. It said to host the vhost content in either the Applications folder or Users folder. So I moved my SVN_Repositories folder to my Users folder so it was like this: “/Users/username/SVN_Repositories/ExampleRepo/trunk/httpdocs/”
It finally worked! So the lessons I learned were:
- Put your vhost content in the Users folder.
- If you try things from the terminal, make sure you do ./apachectl so you execute the correct binary file.
- Most of your config files are in the /Applications/xampp/etc/ folder.
As always, hopefully this helps someone. Feel free to leave any questions or comments.
Related Posts
- Memcached: Simple, Effective, and Powerful Realizing once again I haven’t written a blog post for quite some time, I thought I would just write a few smaller posts on things I’ve learned these last few months. Hopefully I can get back into the habit of blogging regularly again. This last month I finally broke down...
- So You Want To Be A Web Developer? <tangent> This last week I’ve been talking with my brother Brack, who to say the least, absolutely abhors his job. Well, maybe abhor is a little strong, but he is extremely frustrated and unsatisfied. He works at a air force base in the human resource department and he basically helps...
- Data Backups – There Are No Excuses Today I just had the terrible experience of having a database lose data, need to restore, only to not have a recent backup. If you haven’t had this experience before, please, take this serious. My wife was home for lunch as it happened, and she watched as the blood drained...
- My 2009 Technology Recap Its been two years now that I’ve been a more or less “serious blogger.” I had using the term blogger, since when people hear about blogs, they think of people either detailing their entire lives, or pumping some angel. For me, blogging has just been a way to share information...

6 Responses
Comments RSS Feed.
Had you tried MAMP http://www.mamp.info/en/index.html as well?
I had read about MAMP, but the stubborn part of my kept trying XAMPP. It was because at first I assumed XAMPP for Mac was an identical port of the Windows version. I thought I would be able to use XAMPP easier.
I think I will give MAMP a try. I’m just a little hesitant, worried somehow XAMPP will fubar MAMP or vice versa. But I think give it a spin now to see if I like it better.
You should also try the just released beta of Zend Server CE. It has a nice Mac OS X download and if you get your feedback in soon (on their forums), you might even make it a better product when it’s released… It’s available here: http://www.zend.com/en/products/server/downloads-all
I’m still on the fence and researching whether to install xampp or mamp on my mbp, so thanks for sharing your hard-earned knowledge with us newbies. It’s appreciated.
Here is a guide if anyone needs help setting this up on windows…
http://renownedmedia.com/blog/setting-up-vhosts-using-xampp-or-apache-in-windows/
If you are setting up for development or personal web sharing, why not just load the separate programs? It is so easy now days and you can develop as well as serve up your web pages without the hassle of switching between programs. Unless you are disconnected from the web, you don’t need mamp, xampp, lamp, or wamp. On a Mac, just load mysql and go. Updating php is a breeze also.