Categories: Blog

Execute MAMP’s PHP and mysql in command line terminal OSX

Quick tip, if you have MAMP installed on your machine and need to run PHP or mysql via the terminal/command line, you can execute these lines to create symbolic links to point within your MAMP instance:

sudo mv /usr/bin/php /usr/bin/php-bak
sudo ln -s /Applications/MAMP/bin/php/php5.3.14/bin/php /usr/bin/php
sudo ln -s /Applications/MAMP/Library/bin/mysql /usr/bin/mysql

Be sure to change the PHP folder to match the version you want by browsing the following path: /Applications/MAMP/bin/php/

The reason for renaming the existing PHP instance is because OSX runs its own web server (if Web Sharing is enabled).

Peter Tran

Share
Published by
Peter Tran

Recent Posts

Kubernetes Resources to Learn From

I have been fortunate in working a lot more with Kubernetes lately over the last few months so I've been…

1 year ago

WordPress Development using Docker

Building my portfolio site, I thought I'd show you how I set up my Wordpress development using Docker. Given the…

1 year ago

Blank images in Puppeteer screenshots solved!

Frustrated with getting blank images in Puppeteer Chrome screenshots, recently I was in a situation where I needed to migrate…

1 year ago

Plans Moving Forward – The Revamped Web and I

It has been six year since my last major revamp/redesign of my current petertran.com.au portfolio site. So what are my…

1 year ago

Bad owner or permissions on .ssh/config

This article helps to solve a Bad owner or permissions on .ssh/config issue occurring on a Windows 10 machine when…

1 year ago

Accept payments easily and effortlessly with Pin Payments integration

Only a few lines of code required is to implement a payment system, thanks to inline Pin Payments integration. Accepting…

6 years ago