OSX Command line MAMP for use with Laravel and Composer.

I love OSX, but I always hated setting up a new system. OSX does little to empower developers out of the box.

Categories: Development

I love OSX, but I always hated setting up a new system. OSX does very little to empower developers these days. I know I could use Docker or some VM to run my development but I have never had issues syncing my local development with my server environment. I feel like a lot of those issues come from people over-engineering their architecture. I get it though, it’s cool to be like the big boys. But I like to use MAMP because it’s “simple”.

When it comes to running local PHP I use MAMP because of its simplicity.

But it’s not without issue, and this has more to do with OSX than MAMP. Attempting to use Laravel you will be required to use Composer.

Installing composer is simple and you will probably even be able to install Laravel and its packages but once you run an artisan command you will see “Laravel requires the Mcrypt PHP extension”. A similar message will also show when running PHPMyAdmin.

We could fix this by using HomeBrew but I like to keep things simple.

Run which php and you should see /usr/bin/php

To fix this make an edit to ~/.profile and add the following two lines.

export PATH=”/Applications/MAMP/Library/bin:$PATH”
export PATH=”/Applications/MAMP/bin/php/php5.4.4/bin:$PATH”

Obviously, the PHP version in the path should machine the version you are using.

Run source ~/.profile to reload your profile and now run which php and you should now see /Applications/MAMP/bin/php/php5.4.4/bin/php

Adam Patterson

Adam Patterson

User Interface Designer & Developer with a background in UX. I have spent 5 years as a professionally certified bicycle mechanic and ride year-round.

I am a husband and father of two, I enjoy photography, music, movies, coffee, and good food.

You can find me on Twitter, Instagram, and YouTube!