Command Line MAMP

I just installed MAMP on my Macbook. This is great, as it gives me MySQL, Apache, and PHP all ready to go. First, I restored default ports in preferences, and then I discovered the beauty of TextMate shortcuts when I typed in vhost[tab] in my httpd.conf file while adding in some of my dev sites. Beautiful. I was ready to go. Now, I just needed to load up some databases. Off to the command line… But, there was no mysqladmin. On top of that, the default php 4 install was in my way when I went to do pear upgrades.

The binaries I wanted were there. They just weren’t in my bash path. Once I found the directories I needed, I just added them to my path by appending the following lines to my ~/.profile…

# Add MAMP binaries to front of path
PATH=/Applications/MAMP/bin/php5/bin:\
/Applications/MAMP/Library/bin:$PATH
export PATH

You’ll notice the existing PATH is appended to the end so that my MAMP php binary is now found before the old php4 version when I type ‘php’ from the command line. I also have access to mysqladmin, mysql, etc. like I would on just about every other machine as well as apachectl so I can do things like config tests and vhosts dumps (apachectl -S).

In my opinion, this should really be a part of the MAMP install. Anyway, I thought I’d document it here for future reference.

6 Responses to “Command Line MAMP”

  1. jasonz Says:

    sweet! thanks for putting this up. much appreciated.

  2. Steven Merrill Says:

    David,

    For what it’s worth, XAMPP for Mac OS X at http://www.apachefriends.org/en/xampp-macosx.html is quite excellent, and I’ve abandoned MAMP for it. It comes with nice new stuff, like PHP 5.2 and PHP 4 and yet it has a graphical control panel app and installer, as well.

    If you’ve got MAMP working, you might not need it, but I thought I’d mention it.

  3. Steven Merrill Says:

    Also, welcome to the Mac fold - I know I’m enjoying being back after my time in Windows-land.

  4. Adam Says:

    Much thanks for posting this info! I spent several hours last night trying to figure this out so I’m glad I came across your site this morning. Works like a CHAMP! Adding to del.icio.us for future reference.

  5. ali Says:

    genius - thanks for that

  6. tara Says:

    Saved my day! Thanks for this post, I was soooo sick of phpMyAdmin.

Leave a Reply