PHP

Getting command line access to PHP and MySQL running MAMP on OSX

If you have MAMP installed on your Mac OS X box, you're probably going to want command line access to those applications at some point. Assuming you're running a default install you'll run into difficulty when you type php or mysql without logging into the appropriate directory. In MAMP the directories are as follows: /Applications/MAMP/bin/php5/bin/php


If you have MAMP installed on your Mac OS X box, you're probably going to want command line access to those applications at some point. Assuming you're running a default install you'll run into difficulty when you type php or mysql without logging into the appropriate directory. In MAMP the directories are as follows:

/Applications/MAMP/bin/php5/bin/php
/Applications/MAMP/Library/bin/mysql

Rather than referencing those full paths every time you'll probably want to include them in the PATH. You can do this by editing your .profile file. (You can get to the directory where this lives by typing cd).

Use a text editor to open up .profile and change the following line:

export PATH=/opt/local/bin:/opt/local/sbin:$PATH

To include the additions to the $PATH like so:

export PATH=/Applications/MAMP/Library/bin/:/Applications/MAMP/bin/php5/bin/:/opt/local/bin:/opt/local/sbin:$PATH

You'll probably need to make the shell reload your profile like so:

. ./.profile

Also if you have any problems connecting to mysql you may need to run the following command:

sudo ln -s /Applications/MAMP/tmp/mysql/mysql.sock /tmp/mysql.sock

Thanks to the following blog entries:
http://www.tech-recipes.com/rx/2621/os_x_change_path_environment_variab…

Similar posts

Get notified on new marketing insights

Be the first to know about new B2B SaaS Marketing insights to build or refine your marketing function with the tools and knowledge of today’s industry.