Monthly Archives: May 2014

How to setup htaccess in MAMP

I battled with this quite a bit. First I installed MAMP PRO and setup a couple of local sites. Everthing worked flawlessly. This include htaccess files in the root folder of each website which worked properly without a hitch. Then my MAMP PRO trial expired. My sites stopped working. I began to setup new sites which worked flawlessly with little effort BUT my htaccess was not working!

A couple of Issues with MAMP PRO and MAMP

Lets talk about a couple of issue that I found with MAMP and MAMP PRO. First I installed a database in MAMP PRO for one of the site. Everything worked great. After the 15 day trial ended, I had no option but to use MAMP. Found out that the database I created no longer existed! I had to recreated that database (and setting up virtual host also from scratch) and it start to work. But what happened to my database. Did it got deleted, was it a bug in MAMP PRO that automatically deleted the the DB I had created. Well that was not the case. What I found MAMP and MAMP PRO or different products (sort of) even though both were working under the same port in my case (http:8888 and mysql:8889), they were really accessing sites esp different databases. Even both database has different users. Interestingly both database were setup on same localhost and same port!

MAMP PRO Still works even after Trial Period has expired

This was surprising for me (a pleasant one). Even though the trial period had expired, I could actually access MAMP PRO Gui. In the top navigation bar, there appears a blue elephant icon. Click on it and you access MAMP PRO GUI as well start and stop services. I was also able to access my old MAMP PRO sites that I had setup (and thought they were not working anymore).

Interesting thing is, if I start MAMP PRO and access PHPMYADMIN, I would see the old database. If I stopped MAMP PRO server and started MAMP, I would see the new database I had setup (the old one does not show). Similarly each database had different user setup (with different password). Interesting both use 8889 ports.

Confusion between MAMP and MAMP PRO

In short it seems like there is a big confusion between MAMP and MAMP PRO although we may not realized it. This basically makes things more complex esp if we do not know how the two products works together. After the trial period of MAMP PRO expires, the databases that were created are gone. One has to setup new databases. Also one has to setup new virtual hosts as well from scratch. There is surprising twist that MAMP PRO still works even after it is expired which many might now know or expect.

How to make htaccess work

There are couple of posts on SO that address this question. I played with all these setting but it did not work for me. Let me try to provide some basic troubleshooting tips which might be helpful if you tried many different things.

  1. Make sure, your htaccess is named .htaccess and not htaccess.
  2. Make sure it is sitting in the root directory of your site.
  3. Create a basic redirect rule and make sure it works. This basically insures that your htaccess did get kicked in

If the above test passes, then all are set. If not you have to fix it to make sure your .htaccess files does kicks in when routing.

How to setup websites(virtual hosts) on mac using MAMP

MAMP PRO allows you to setup website directly through provide GUI (Graphical User Interface) but in MAMP (free), you will have to setup it up manually. There following 3 steps are needed to setup a local site or Virtual Host in MAMP.


  1. Setup local host first, issue the following command in Terminal (command prompt)
    sudo pico/etc/hosts

    Add a new entry at the bottom in the following form      mysitename

    mysitename can be any name that you want to choose. You will access you site by tying mysitename in URL.

  2. Edit httpd.conf. Select Finder->Go->”Go to folder”. Type /Applications/MAMP/conf/apache/httpd.conf. Open this file in your favorite text editor. I use textmate. Go to line #569 or search for Virtual hosts. Comment out the following line so that it looks like this
    # Virtual hosts
    Include /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf
  3. Now go to https-vhosts.config, which is sitting inside the same folder in the ‘extra’ subfolder. Edit the file as the following

    <VirtualHost *:8888>
    DocumentRoot "/Users/work/Sites/MySite"
    ServerName mysitename
    ServerAlias mysitename
    ErrorLog "logs/"
    CustomLog "logs/" common

Notice that I used port 8888. The default port is 80. It is not required if you want to use default port, you can simply use * that would indicate any port.

Last thing, you should copy the following above the first virtual host that we entered above. This way you can access localhost:8888 correctly.

<VirtualHost *:8888>
DocumentRoot "/Applications/MAMP/htdocs" 
ServerName localhost 

Do not forgot to restart the webserver (both apache and mysql). Also make sure you access the site by speccing the port 8888, like this


Issue connecting to MySQL DB

I had an issue connecting to mysql DB even though the supplied username and password were correct. I fixed that by simply creating a new user, giving it all privileges, by going to privilege tab in myphpadmin:8889.


On thing I noticed when my MAMP PRO trial (15 days) expired, it deleted the database that I had created in mysql as well. Not sure if this is a bug in the MAMP PRO, but you may want to watch out for it.

How to import SVN Repository into Assembla Mac Tutorial

This took be a bit. You want to create a repository on Assembla that you can access from anywhere and contribute. The problem is you created a repository successfully but you can’t add or import files to it. This is tutorial for you if you are using mac (macintosh) computer.

Ok so first create your SVN repository on Assembly. Now you need to import files. If you do not really have an SVN Repository locally, you will have to create one. Simple zipping a files or folder and importing to Assembla does not work.

So create a local repository. I have used SmartSVN (Free version) for that. Import all your files to it. Now you have a fully work local repository where you can add/commit changes.

Now create an SVN Dump. SVN Dump is not the same as zipping your SVN Reposiory. You will have to use svnadmin command to create the dump. The following is the command that you need to run

svndadmin dump /local-path-to-repository/repository > my_rep_dump.txt

Not that that /local-path-to-repository/ is the actually path where the repository was created. In my case the command was

svnadmin dump /Projects/Repositories/Project1 > Project1_dump.txt

SVN Repository on Mac

The following it the directory structure of my “Project1” repository. After this zip the folder and upload it to Assembla using import/export feature. It would say “The file has been queued”. It would probably take 5 minutes when you whole repository will appear with complete history.

Note that

“>” is redirection operator. It redirects the outout of the command to a file.
Project1_dump.txt, is the file where the output is directed to. You can use any name or extension for this file. You need to zip this file and upload it. (do not modify it in any way!)

directory is already under version control SmartSVN

Directory already under version control - smartSVN error

Directory already under version control – smartSVN error

I was getting this error while adding my project in SmartSVN and I had no clue whatsoever

*directory* is already under version control SmartSVN

The reason I was getting this error was because I had select the root folder and the sub folder and choose to add the files recursively . That basically added the sub-folder two time, one time as part of recursion and a second time because it was explicated added.

Simple solution is, select only the root folders and click add *recursively* or select all folder and choose to “Only Add Directory”.  The first solution worked better for me btw. Hope this helps someone.

SmartSVN Add files recursively

SmartSVN Add files recursively

setup virtual hosts in mamp

WAMP PRO Virtual Host Setup

WAMP PRO Virtual Host Setup

Creating virtual hosts in MAMP is intact really easy. You do not need to change host file. A nice GUI is provided. Here is the the tutorial (not that this might by ‘MAMP PRO’ GUI in trial version). I can confirm if this is feature is available only in MAMP or MAMP PRO.

1. Fire up MAMP. Go to spotlight search and type “MAMP”. If executable file is not showing up in spotlight, click on the mamp folder that is shown. Inside the mamp folder, there is mamp executable (mac), click on that.

2. Go to “Host” tab at the top. Click on the + sign in the bottom left hand side to add hostname. Type your hostname in the textbox in the top right corner. I have typed “myfirstvirtualhost”

3. Notice that there is a red icon next to document root. Click on the folder icon, navigate to the folder/directory from where you want to host the site.

4. Click on the arrow icon next to server name text box. This will open web browser and open your site with the given hostname.

Note that you may need to save you setting which will basically restart the server.

compare files and folders on mac

The following are utilities that can be used to compare files and folders on mac.

1. DiffMerge

Diffmerge is an excellent utility to compare files and folders on mac. It also allows merge from left to right (only). The interface is nice. Usage is really awesome. Tip: Make sure nothing is select under View menu. This will show only differences in files including subfolders. Once you address that, play with other options to copy missing files etc

2. Kdiff3

Kdiff3 provies a more rudimentary user interface but it does allow powerful merging. It compares file and folder and allows two way merging (really 3 ways). Kdiff actually allows comparing 3 folders which is really awesome.


This is paid software but 15 day trial is available. It is extremely powerful and user friendly. It compares not only text files but images also.