Using the terminal with MAMP on OS X
Recently I was going to take the promising Symfony PHP framework out for a quick test drive, but ran into trouble in the very beginning of the tutorial. I’m running MAMP for local PHP development, but the terminal is using the built-in PHP version for its command line scripting. And Symfony is all about generating models and scaffolds through the command-line in a railsy sort of way… bummer.
A quick search for led me to a discussion thread in the MAMP forum, outlining the following solution. I’ve modified it a bit, using move instead of copy, and adding some necessary SUDO instructions:
- Backup current php version by renaming it (optional)
$ sudo mv /usr/bin/php /usr/bin/php4 - Create a symbolic link pointing to the PHP version supplied by MAMP
$ sudo ln -s /Applications/MAMP/bin/php5/bin/php /usr/bin/php - Done!
Now, onwards with the tutorial…
9 comments so far. Go ahead, write something
You can follow any responses to this entry through the RSS feed
thanks a lot :)
#1 balsagoth 28 Nov 06
Been stuck on this for a couple of hours but it works fine now. Thank you very much.
#2 BenvdS 28 Dec 06
Just thought you saved me on this one but installing via Pear still left me without a symfony.sh to be found anywhere on my system :-( Have you had any success or are you just using the sandbox example?
#3 Carsten Rose Lundberg 31 Dec 06
Thanks! This worked great. *NOTE: I’m only using the Sandbox right now.
#4 Jeff B. 25 Mar 07
very helpful, thanks!
#5 Cristina 11 Dec 09
[...] dank aan twob.net voor de nodige [...]
#6 PHP versie van MAMP in terminal gebruiken | Junni's webstek 08 Apr 10
Thanks a lot for this. In order for me to run php -v (check version) I had to edit the permissions on the MAMP php file:
cd /Applications/MAMP/bin/php5.3/bin
chmod 755 php (read and execute permissions for everyone, write permissions for the owner)
After this i could then successfully confirm I was running php 5.3 from MAMP server.
Cheers
#7 Steve 11 Jul 10
Thanks
#8 Ami 07 Sep 11
great. thanks
#9 Tom 20 Jan 12
Type here: