Tools – See A Need Fill A Need

Your time and my time is precious. I am grateful for tools that help me get work done quicker and better. I was reminded today how grateful I am for these tools as one was letting me know that it was updating to fix some issues that were found recently.

Tools can be immensely useful but only if used properly or at all. Here are some of my thoughts on finding and using tools better.

  1. Decide today that you are going to try new tools
  2. Don’t try every new tool that you find
  3. Watch and learn from others around you
  4. Really learn how to use the tool
  5. Question the tools you are currently using
  6. Wish
  7. Build new tools

If you decide today that you are going to take the time and effort to use a new tool when you find one, it will be much easier than deciding right when you find it and don’t feel like you have the time right then or the motivation. If you tried every new tool that you found, you might not have time to actually do anything else. This depends on how many different tools you are finding and trying but it’s good to use some common sense in this area. Others may have found great tools that you didn’t know about and paying attention to what your friends and coworkers are using can help you find tools that you might not have otherwise. This also goes for how others use the same tool that you do. It always kills me to watch others use a tool and see that they are greatly under utilizing the potential of the tool.

Have you ever wondered why a tool works the way it does? Have you ever used a tool or an app and thought, “That was stupid.” Questioning current methods and tools helps us find and move on to better ways. Many years ago I was in a typing class in Jr High learning how to type. The teacher told us how the qwerty keyboard keys were arranged with the goal to slow down a typist to prevent typewriter arms from jamming up. I remember wondering why we were being taught a keyboard configuration made to slow us down. Unfortunately, no alternatives were presented at that time but several years later I came across dvorak! Dvorak was designed with the goal of being more natural and reflecting the common english language. I made the switch to typing using dvorak just over 3 years ago and I have never looked back.

Have you ever heard yourself or anyone else say, “I wish that…”? This is usually how the sentence begins when someone recognizes that there could be a better way. Don’t just let those realizations just float by you without thought or action. Do a Google search for a better way or tool to see if you can find one. Ask your friends if they know a better way. Ask an expert in the related area if they have advice on a better way or tool. If none of these return results, then it’s your turn to come up with a better way or tool. All the tools that I know of and use on a regular basis came to be because someone recognized that there could be a better way and made it so. One person can make a difference. You can make a difference by educating yourself, recognizing areas of need, and taking action.

I really enjoy helping others, finding better ways to do things, and building tools which is a big part of why I enjoy my job as much as I do. Here are some of the tools that I use on my Mac that make tasks easier and more enjoyable.

Xdebug Cachegrind and MAMP Pro on Mac OSX

Are you running MAMP on OSX? Want to profile your PHP code with Xdebug? It’s easy and here are the steps.

How to run Xdebug on Mac OSX using MAMP

1 Start MAMP

2 Edit php.ini template file through MAMP to enable the extension. Edit the template file via File -> Edit Template -> PHP -> PHP php.ini

edit php.ini template for mamp on mac osx

3 Edit bottom of php.ini template file so that it ends up looking like if you want profile output

xdebug.profiler_enable = 1
xdebug.profiler_output_dir = "/tmp"
; DONT REMOVE: MAMP PRO php5.3.6.ini template compatibility version: 1

If you don’t want profile output and just want xdebug running then use

xdebug.profiler_enable = 0
xdebug.profiler_output_dir = "/tmp"
; DONT REMOVE: MAMP PRO php5.3.6.ini template compatibility version: 1

Now when you have errors, if they are sent to standard out, you will see something like this

My php.ini file:

edited php.ini file to run xdebug on mamp mac osx

4 Save edited template and close edit window

5 Restart MAMP

6 Open MAMP’s WebStart page and navigate to PHPInfo tab. Check to make sure that Xdebug is running. Doing a search in the browser window for “Xdebug” makes this easy.
confirm xdebug running on mamp on mac osx

7 If you used the same settings that I have above, when you run PHP code, Xdebug will put the cachegrind.out files in your ‘/tmp’ directory. Open your ‘/temp’ directory and run one of your PHP files to make sure it is working correctly. You can open the ‘/tmp’ directory in finder by opening the terminal and running

open /tmp

cachegrind.out output in /temp folder for mamp on mac osx

8 Now you can use any app that understands those cachegrind.out files to view the profile data. Apps like KCacheGrind (Linux/Windows, KDE), WinCacheGrind (Windows), xdebugtoolkit, and Webgrind.  I went the simple route and used webgrind. Webgrind is a simple web based application that you can run locally on MAMP and it will look for the cachegrind.out files automatically with just one click. Continue for steps on setting up with webgrind.

9 Download Webgrind

10 Setup Webgrind host on MAMP to run Webgrind

Setup webgrind as host on mamp to process xdebug php profile output

11 Visit webgrind url setup on your local MAMP installation. Mine was simply webgrind/

12 If you already have cachegrind output files you should be able to select the file in the “Auto (newest)” dropdown or leave it select at Auto and click update which will reveal the profile data

13 Throw a celebratory fist pump


I think it’s awesome that the MAMP guys have included Xdebug with their release of MAMP 2.01. I wrote this blog post because I wanted to be able to profile some of my projects to find areas where they could be improved. After finally figuring it out it was super simple. The problem was that it took me a long time to set up because of all of the incorrect and outdated information on the internet. I hope this makes it easier for others to get setup. If this post becomes outdated please leave a comment or contact me about what needs to be updated.


I am LOVING Xdebug! Just realized that when you do a var_dump of some variable, Xdebug formats it for you so it’s actually readable! AMAZING!!!!



Things I searched for to find my answers:
php profile
xdebug osx
mamp xdebug
php xdebug osx
cachegrind osx
xdebug mamp
php.ini add extension mamp