Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How start & stop MAMP PRO using command line?

I am trying to find a way by which I can start and stop MAMP PRO's Apache and mysql using command line. So far whatever I have search has only helped me start MAMP PRO.

Thanks.

like image 253
Jenil Gogari Avatar asked Jul 10 '13 11:07

Jenil Gogari


2 Answers

As of at least MAMP 3.0.6, the following works for both Free and Pro versions:

Open MAMP Pro or Free, depending on the one you use:

Pro: open /Applications/MAMP\ PRO/MAMP\ PRO.app/

Free: open /Applications/MAMP/MAMP.app/

Then, cd into MAMP/bin:

cd /Applications/MAMP/bin 

To start Apache & MySQL:

./start.sh 

To stop Apache & MySQL:

./stop.sh 

Note that you might need to sudo the commands above.

like image 103
miguelcaires Avatar answered Sep 21 '22 02:09

miguelcaires


After much trial and error:

Note that I have my ports set to the application's respective defaults (Apache: 80, MySQL: 3306), and as such these commands reflect that, AND you must use sudo with Apache (which you will in MAMP as well if you're using port 80).

Apache

sudo /Applications/MAMP/Library/bin/httpd -f "/Library/Application Support/appsolute/MAMP PRO/conf/httpd.conf" -k start

sudo /Applications/MAMP/Library/bin/httpd -f "/Library/Application Support/appsolute/MAMP PRO/conf/httpd.conf" -k stop

sudo /Applications/MAMP/Library/bin/httpd -f "/Library/Application Support/appsolute/MAMP PRO/conf/httpd.conf" -k restart

MySQL

To start MySQL:

sh -c '/Applications/MAMP/Library/bin/mysqld_safe --defaults-file=/Applications/MAMP/tmp/mysql/my.cnf --port=3306 --socket=/Applications/MAMP/tmp/mysql/mysql.sock --user=alex --pid-file=/Applications/MAMP/tmp/mysql/mysql.pid --log-error=/Applications/MAMP/logs/mysql_error_log.err --tmpdir=/Applications/MAMP/tmp/mysql/tmpdir --datadir=/Library/Application\ Support/appsolute/MAMP\ PRO/db/mysql &'

(for some reason you must hit enter again to regain your prompt)

To stop MySQL:

sh -c '/Applications/MAMP/Library/bin/mysqladmin -u root -proot --socket=/Applications/MAMP/tmp/mysql/mysql.sock shutdown'

As a bonus, the indicators in the MAMP PRO.app GUI show the correct status of these apps in real time, so you can continue to rely on that.

I have MAMP PRO v2.0.3.

like image 20
Astockwell Avatar answered Sep 20 '22 02:09

Astockwell