Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Instructions on how to change preinstalled Mac OS X PHP to MAMP's PHP Installation and then install Composer Package Management

Change default Mac OS X PHP to MAMP's PHP Installation and Install Composer Package Management


Instructions to Change PHP Installation


First, Lets find out what version of PHP we're running (To find out if it's the default version).

To do that, Within the terminal, Fire this command:

which php

This should output the path to the default PHP install which comes preinstalled by Mac OS X, by default it has to be (Assuming you've not changed it before):

/usr/bin/php

Now, We just need to swap this over to the PHP that is installed with MAMP, which is located at /Applications/MAMP/bin/php/php5.4.10/bin (MAMP 2.1.3)

To do this, We need to edit the .bash_profile and add the MAMP version of PHP to the PATH variable.

Follow these simple steps:


  1. Within the Terminal, run vim ~/.bash_profile

  2. Type i and then paste the following at the top of the file:

     export PATH=/Applications/MAMP/bin/php/php5.4.10/bin:$PATH
    
  3. Hit ESC, Type :wq, and hit Enter

  4. In Terminal, run source ~/.bash_profile

  5. In Terminal, type in which php again and look for the updated string. If everything was successful, It should output the new path to MAMP PHP install.

  6. In case it doesn't output the correct path, try closing the terminal window (exit fully) and open again, it should apply the changes (Restart in short).

Install Composer Package Management


Now you can fire the command to install the composer globally (So you can access it from anywhere):

$ curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

You can verify your installation worked by typing the following command within the Terminal:

composer

It'll show you the current version and a list of commands you can use if the installation was successful.

@thejwalker

This comment has been minimized.

Show comment Hide comment
@thejwalker

thejwalker Dec 13, 2013

These are good instructions but for some reason my path is not updating. I'm comfortable with command line and vim but after running source ~/.bash_profile I still get /usr/bin/php

My MAMP is running PHP 5.4.3 and I'm on OSX 10.7.5

Thanks for posting.

These are good instructions but for some reason my path is not updating. I'm comfortable with command line and vim but after running source ~/.bash_profile I still get /usr/bin/php

My MAMP is running PHP 5.4.3 and I'm on OSX 10.7.5

Thanks for posting.

@xulfiqarameen

This comment has been minimized.

Show comment Hide comment
@xulfiqarameen

xulfiqarameen May 3, 2014

Still getting the same /usr/bin/php

Still getting the same /usr/bin/php

@tvalentius

This comment has been minimized.

Show comment Hide comment
@tvalentius

tvalentius May 7, 2014

thanks for the instruction, help's me a lot setting up laravel on mac :)

thanks for the instruction, help's me a lot setting up laravel on mac :)

@zeratool

This comment has been minimized.

Show comment Hide comment
@zeratool

zeratool May 8, 2014

@xulfiqarameen edit your ~/.bash_profile replace it with your homebrew php install.

zeratool commented May 8, 2014

@xulfiqarameen edit your ~/.bash_profile replace it with your homebrew php install.

@zeratool

This comment has been minimized.

Show comment Hide comment
@zeratool

zeratool May 8, 2014

@jonwalkertn if you;re saying under apache via browser, you must edit "/etc/apache2/httpd.conf" and look for the line "LoadModule php5_module" and replace it with your php homebrew install.

zeratool commented May 8, 2014

@jonwalkertn if you;re saying under apache via browser, you must edit "/etc/apache2/httpd.conf" and look for the line "LoadModule php5_module" and replace it with your php homebrew install.

@zhiachong

This comment has been minimized.

Show comment Hide comment
@zhiachong

zhiachong Jun 9, 2014

@jonwalkertn are you using oh-my-zsh by any chance? That's what I'm using, and instead of editing ~/.bash_profile, edit your ~/.zshrc instead, and add the exact same lines. Then run source ~/.zshrc. That solved the issue for me.

@jonwalkertn are you using oh-my-zsh by any chance? That's what I'm using, and instead of editing ~/.bash_profile, edit your ~/.zshrc instead, and add the exact same lines. Then run source ~/.zshrc. That solved the issue for me.

@JonasLandstrom

This comment has been minimized.

Show comment Hide comment
@JonasLandstrom

JonasLandstrom Aug 30, 2014

Thanks a lot, 2 hours of pain solved!

Thanks a lot, 2 hours of pain solved!

@dysan1376

This comment has been minimized.

Show comment Hide comment
@dysan1376

dysan1376 Sep 19, 2014

It worked!! thanks!

It worked!! thanks!

@phpguru

This comment has been minimized.

Show comment Hide comment
@phpguru

phpguru Dec 15, 2014

Yosemite comes with Apache 2.4 & PHP 5.5 preinstalled. You don't need MAMP, only MySQL or MariaDB.

Regardless, you can use PHP 5.5, PHP 5.4 or PHP 5.3 as needed. Try the following...

sudo mv /usr/local/bin/php /usr/local/bin/php55
sudo mv /usr/bin/php /usr/bin/php55

Install PHP 5.4

brew install php54 php54-mcrypt php54-mysql

Install PHP 5.3

brew unlink php54
brew install php53 php53-mcrypt php53-mysql

Switch to PHP 5.4

brew unlink php53
brew link php54

Switch to PHP 5.5

brew unlink php54
brew unlink php53
sudo ln -s /usr/local/bin/php55 /usr/local/bin/php
sudo ln -s /usr/bin/php55 /usr/bin/php

phpguru commented Dec 15, 2014

Yosemite comes with Apache 2.4 & PHP 5.5 preinstalled. You don't need MAMP, only MySQL or MariaDB.

Regardless, you can use PHP 5.5, PHP 5.4 or PHP 5.3 as needed. Try the following...

sudo mv /usr/local/bin/php /usr/local/bin/php55
sudo mv /usr/bin/php /usr/bin/php55

Install PHP 5.4

brew install php54 php54-mcrypt php54-mysql

Install PHP 5.3

brew unlink php54
brew install php53 php53-mcrypt php53-mysql

Switch to PHP 5.4

brew unlink php53
brew link php54

Switch to PHP 5.5

brew unlink php54
brew unlink php53
sudo ln -s /usr/local/bin/php55 /usr/local/bin/php
sudo ln -s /usr/bin/php55 /usr/bin/php
@digitalnerve

This comment has been minimized.

Show comment Hide comment
@digitalnerve

digitalnerve Jan 11, 2015

Many thanks - very helpful

Many thanks - very helpful

@ghost

This comment has been minimized.

Show comment Hide comment
@ghost

ghost Feb 28, 2015

Solved my problems :). Trying to install Laravel5 on a MAMP Pro server, and had all sorts of problems, especially (missing mcrypt).
Using this solution so it uses MAMP's php, everything now works.

ghost commented Feb 28, 2015

Solved my problems :). Trying to install Laravel5 on a MAMP Pro server, and had all sorts of problems, especially (missing mcrypt).
Using this solution so it uses MAMP's php, everything now works.

@kirensiva

This comment has been minimized.

Show comment Hide comment
@kirensiva

kirensiva Apr 21, 2015

After following the steps which, vim command not working. Please help me to solve this

After following the steps which, vim command not working. Please help me to solve this

@irazasyed

This comment has been minimized.

Show comment Hide comment
@irazasyed

irazasyed Apr 28, 2015

These are some pretty old instructions. I've already moved to Vagrant setup for the dev environment. You guys need to explore Vagrant really! Much better there.

You can use this awesome vagrant box called Homestead. Not limited to Laravel, can be used for anything.

Owner

irazasyed commented Apr 28, 2015

These are some pretty old instructions. I've already moved to Vagrant setup for the dev environment. You guys need to explore Vagrant really! Much better there.

You can use this awesome vagrant box called Homestead. Not limited to Laravel, can be used for anything.

@Dat-TSC

This comment has been minimized.

Show comment Hide comment
@Dat-TSC

Dat-TSC Jun 23, 2015

You have to close then re-open the terminal to see the effect. Cheers.

Dat-TSC commented Jun 23, 2015

You have to close then re-open the terminal to see the effect. Cheers.

@pandyatama17

This comment has been minimized.

Show comment Hide comment
@pandyatama17

pandyatama17 Jul 1, 2015

oh man i love you so much

oh man i love you so much

@cheldernunes

This comment has been minimized.

Show comment Hide comment
@cheldernunes

cheldernunes Sep 17, 2015

Tank you !! very helpful

Tank you !! very helpful

@sethdaniel

This comment has been minimized.

Show comment Hide comment
@sethdaniel

sethdaniel Oct 27, 2015

Thank you so much! Nothing I was doing was working until this. I was about ready to punch monkeys in the face. This write up saved a bunch of monkeys from being punched.

Thank you so much! Nothing I was doing was working until this. I was about ready to punch monkeys in the face. This write up saved a bunch of monkeys from being punched.

@cord

This comment has been minimized.

Show comment Hide comment
@cord

cord Feb 9, 2016

for me this was necessary to set the php version:

vim ~/.profile

PATH=/usr/local/php5/bin:$PATH

source ~/.profile

then php -v shows the correct php is used

cord commented Feb 9, 2016

for me this was necessary to set the php version:

vim ~/.profile

PATH=/usr/local/php5/bin:$PATH

source ~/.profile

then php -v shows the correct php is used

@verapi85

This comment has been minimized.

Show comment Hide comment
@verapi85

verapi85 Feb 16, 2016

@cord thank you for your comment, it works for me as well.

@cord thank you for your comment, it works for me as well.

@rotexhawk

This comment has been minimized.

Show comment Hide comment
@rotexhawk

rotexhawk Mar 18, 2016

This switches it for the cli but apache might still be using the old php.

This switches it for the cli but apache might still be using the old php.

@kslusarczyk89

This comment has been minimized.

Show comment Hide comment
@kslusarczyk89

kslusarczyk89 May 18, 2016

Im using oh-my-zsh and according to @zhiachong advice i did the following instructions with ~/.zshr but it didn't work. After typing which php in iterm i still get /usr/bin/php. Actually when I edit bash_profile it works fine but after closing console I have to constantly type those instructions. Any advise?

kslusarczyk89 commented May 18, 2016

Im using oh-my-zsh and according to @zhiachong advice i did the following instructions with ~/.zshr but it didn't work. After typing which php in iterm i still get /usr/bin/php. Actually when I edit bash_profile it works fine but after closing console I have to constantly type those instructions. Any advise?

@rajamohammed

This comment has been minimized.

Show comment Hide comment
@rajamohammed

rajamohammed Jul 20, 2016

@cord thank you it helped me.

@cord thank you it helped me.

@devansh1110

This comment has been minimized.

Show comment Hide comment
@devansh1110

devansh1110 Jul 27, 2016

Wow, Thanks. It took forever to find these instructions. Everyone said to update ~/.profile.. and it never worked. This guide was truly amazing!

Thanks A lot

Wow, Thanks. It took forever to find these instructions. Everyone said to update ~/.profile.. and it never worked. This guide was truly amazing!

Thanks A lot

@3issamben

This comment has been minimized.

Show comment Hide comment
@3issamben

3issamben Aug 24, 2016

zhiachong Thanks for the answer.

I was using oh-my-zsh . so I had to edit ~/.zshrc

zhiachong Thanks for the answer.

I was using oh-my-zsh . so I had to edit ~/.zshrc

@juliafealves

This comment has been minimized.

Show comment Hide comment
@juliafealves

juliafealves Sep 1, 2016

Thank you! :)

Thank you! :)

@stevenhillsr

This comment has been minimized.

Show comment Hide comment
@stevenhillsr

stevenhillsr Sep 8, 2016

I have created a script that lets you select the version of php you would like to run and creates a sym-link to that version. You can find it here and I have a blog about how to put it to use which you can find here if anyone is interested.

I have created a script that lets you select the version of php you would like to run and creates a sym-link to that version. You can find it here and I have a blog about how to put it to use which you can find here if anyone is interested.

@LTroya

This comment has been minimized.

Show comment Hide comment
@LTroya

LTroya Sep 9, 2016

It works like a charm!

Thanks.

LTroya commented Sep 9, 2016

It works like a charm!

Thanks.

@ghost

This comment has been minimized.

Show comment Hide comment
@ghost

ghost Sep 20, 2016

thanks alot !

ghost commented Sep 20, 2016

thanks alot !

@AustinPaquette

This comment has been minimized.

Show comment Hide comment
@AustinPaquette

AustinPaquette Sep 23, 2016

@irazasyed - thank you very much, you helped me in ways no other resource online seemed to be able to. Appreciate you posting this very very much.

@irazasyed - thank you very much, you helped me in ways no other resource online seemed to be able to. Appreciate you posting this very very much.

@christophe-44-27

This comment has been minimized.

Show comment Hide comment
@christophe-44-27

christophe-44-27 Oct 11, 2016

@irazasyed : I love you !

@irazasyed : I love you !

@stefanjagger

This comment has been minimized.

Show comment Hide comment
@stefanjagger

stefanjagger Oct 22, 2016

Thank you!

Thank you!

@hengsoheak

This comment has been minimized.

Show comment Hide comment
@hengsoheak

hengsoheak Oct 26, 2016

Thanks it is solved my problem in mac too

Thanks it is solved my problem in mac too

@Sifoon

This comment has been minimized.

Show comment Hide comment
@Sifoon

Sifoon Nov 22, 2016

@irazasyed : Thanks very much ! clean & clear and the most important it works wellll.

Sifoon commented Nov 22, 2016

@irazasyed : Thanks very much ! clean & clear and the most important it works wellll.

@jordanbrauer

This comment has been minimized.

Show comment Hide comment
@jordanbrauer

jordanbrauer Nov 30, 2016

Great stuff!! Thanks a lot man. It's hard to find reliable AMP setups for Mac OS X.
I myself am interested in eventually uninstalling MAMP in favour of updating the preinstalled Apache and PHP along with an install of MySQL, but this was an awesome work around for the time being! 👍

Great stuff!! Thanks a lot man. It's hard to find reliable AMP setups for Mac OS X.
I myself am interested in eventually uninstalling MAMP in favour of updating the preinstalled Apache and PHP along with an install of MySQL, but this was an awesome work around for the time being! 👍

@justenpeters

This comment has been minimized.

Show comment Hide comment
@justenpeters

justenpeters Jan 11, 2017

Can someone share the commands to set it back to default?

Can someone share the commands to set it back to default?

@Tuan-T-Nguyen

This comment has been minimized.

Show comment Hide comment
@Tuan-T-Nguyen

Tuan-T-Nguyen Jan 14, 2017

Thank you so much

Thank you so much

@Narayanareddy96

This comment has been minimized.

Show comment Hide comment
@Narayanareddy96

Narayanareddy96 Feb 4, 2017

i have solved with this
vim ~/.bash_profile
added

export XAMPP_HOME=/Applications/XAMPP
export PATH=${XAMPP_HOME}/bin:${PATH}
export PATH

saved !

working perfect :-)

i have solved with this
vim ~/.bash_profile
added

export XAMPP_HOME=/Applications/XAMPP
export PATH=${XAMPP_HOME}/bin:${PATH}
export PATH

saved !

working perfect :-)

@doub1ejack

This comment has been minimized.

Show comment Hide comment
@doub1ejack

doub1ejack Feb 20, 2017

If you're using macport you can just do this:
$ sudo port select php php56

Replace php56 with whatever version you want to switch to. No need to worry about the OS-installed version.

doub1ejack commented Feb 20, 2017

If you're using macport you can just do this:
$ sudo port select php php56

Replace php56 with whatever version you want to switch to. No need to worry about the OS-installed version.

@n4nidhinchandran

This comment has been minimized.

Show comment Hide comment
@n4nidhinchandran

n4nidhinchandran Feb 24, 2017

Great ! Thanks a lot

Great ! Thanks a lot

@rryybbaa

This comment has been minimized.

Show comment Hide comment
@rryybbaa

rryybbaa Mar 4, 2017

This works for me. Thanks

rryybbaa commented Mar 4, 2017

This works for me. Thanks

@eriktecse

This comment has been minimized.

Show comment Hide comment
@eriktecse

eriktecse Mar 31, 2017

Thanks, @zhiachong This works for me.
Using oh-my-zsh by any chance? That's what I'm using, and instead of editing ~/.bash_profile, edit your ~/.zshrc instead, and add the exact same lines. Then run source ~/.zshrc. That solved the issue for me.

Thanks, @zhiachong This works for me.
Using oh-my-zsh by any chance? That's what I'm using, and instead of editing ~/.bash_profile, edit your ~/.zshrc instead, and add the exact same lines. Then run source ~/.zshrc. That solved the issue for me.

@rathorevaibhav

This comment has been minimized.

Show comment Hide comment
@rathorevaibhav

rathorevaibhav Apr 27, 2017

This worked for me. Thanks. I just changed the PHP version that I was using.

This worked for me. Thanks. I just changed the PHP version that I was using.

@davidLpt

This comment has been minimized.

Show comment Hide comment
@davidLpt

davidLpt Apr 28, 2017

I follow the procedure and the change of path is ok. But '$ curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer' give me an curl: (56) SSLRead() return error -9806....... anybody had and solved the same issue?

UPDATE: I did a manual install

davidLpt commented Apr 28, 2017

I follow the procedure and the change of path is ok. But '$ curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer' give me an curl: (56) SSLRead() return error -9806....... anybody had and solved the same issue?

UPDATE: I did a manual install

@dinkarprajapati

This comment has been minimized.

Show comment Hide comment
@dinkarprajapati

dinkarprajapati Apr 29, 2017

To change the php path in mac Sierra, i did the steps mentioned but still when i run

which php

I still get

/usr/local/bin/php

I tried restarting terminal and even mac but it is still the same path. I have followed every steps

  • change bash_profile

export PATH="/Applications/XAMPP/xamppfiles/bin/php-7.0.15:$PATH"

  • did source ~/.bash_profile

Any idea why the path is so stubborn

Solution:
For XAMPP, path I used was wrong. It should be

export PATH="/Applications/XAMPP/bin:$PATH"

dinkarprajapati commented Apr 29, 2017

To change the php path in mac Sierra, i did the steps mentioned but still when i run

which php

I still get

/usr/local/bin/php

I tried restarting terminal and even mac but it is still the same path. I have followed every steps

  • change bash_profile

export PATH="/Applications/XAMPP/xamppfiles/bin/php-7.0.15:$PATH"

  • did source ~/.bash_profile

Any idea why the path is so stubborn

Solution:
For XAMPP, path I used was wrong. It should be

export PATH="/Applications/XAMPP/bin:$PATH"

@arkhipovandrei

This comment has been minimized.

Show comment Hide comment
@arkhipovandrei

arkhipovandrei May 28, 2017

thx

@Memedawn

This comment has been minimized.

Show comment Hide comment
@Memedawn

Memedawn May 28, 2017

Now you can fire the command to install the composer globally (So you can access it from anywhere):
$ curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

The command to install the composer globally doesn't work with me. I'm using Mac OS X system with PHP 5.6.30v, but the root login is still showing 5.4.45, which is frustrating. My PHP is in /usr/bin/php.

The Composer is downloaded and installed, but the above command does not work. I get an error message:

'The defined install dir (/usr/local/bin) does not exist.'

When I did a locate for composer, it was found in 4 locations. It was successfully installed:

Composer (version 1.4.2) successfully installed to: /private/var/root/composer.phar
Use it: php composer.phar

So, does the composer being in multiple locations mean that it is global, or do I still need to specify and why am I still getting two versions of PHP displaying?

Memedawn commented May 28, 2017

Now you can fire the command to install the composer globally (So you can access it from anywhere):
$ curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

The command to install the composer globally doesn't work with me. I'm using Mac OS X system with PHP 5.6.30v, but the root login is still showing 5.4.45, which is frustrating. My PHP is in /usr/bin/php.

The Composer is downloaded and installed, but the above command does not work. I get an error message:

'The defined install dir (/usr/local/bin) does not exist.'

When I did a locate for composer, it was found in 4 locations. It was successfully installed:

Composer (version 1.4.2) successfully installed to: /private/var/root/composer.phar
Use it: php composer.phar

So, does the composer being in multiple locations mean that it is global, or do I still need to specify and why am I still getting two versions of PHP displaying?

@dazjavier

This comment has been minimized.

Show comment Hide comment
@dazjavier

dazjavier Jun 8, 2017

Thanks, this works perfectly!

Thanks, this works perfectly!

@rambhairao

This comment has been minimized.

Show comment Hide comment
@rambhairao

rambhairao Jun 13, 2017

it's not working .
giving same file path

it's not working .
giving same file path

@arianacosta

This comment has been minimized.

Show comment Hide comment
@arianacosta

arianacosta Jun 14, 2017

It might not be as obvious, but the export has to be of the bin folder, be carefull not to do .../bin/php as php is the executable. This will not throw any errors when loading the bash profile, but it will not load the PHP binaries as needed.

So, in my case with MAMP PRO 4.1.1 and MacOS Sierra, I put this in the ~/.bash_profile and it is working fine:

export PATH="/Applications/MAMP/bin/php/php7.1.1/bin:$PATH"

It might not be as obvious, but the export has to be of the bin folder, be carefull not to do .../bin/php as php is the executable. This will not throw any errors when loading the bash profile, but it will not load the PHP binaries as needed.

So, in my case with MAMP PRO 4.1.1 and MacOS Sierra, I put this in the ~/.bash_profile and it is working fine:

export PATH="/Applications/MAMP/bin/php/php7.1.1/bin:$PATH"

@campside

This comment has been minimized.

Show comment Hide comment
@campside

campside Jul 9, 2017

worked perfect form me

campside commented Jul 9, 2017

worked perfect form me

@tutkun

This comment has been minimized.

Show comment Hide comment
@tutkun

tutkun Jul 19, 2017

Thank you!

tutkun commented Jul 19, 2017

Thank you!

@renegaders

This comment has been minimized.

Show comment Hide comment
@renegaders

renegaders Aug 3, 2017

Hi there all.
Perhaps it's really just my own stupidity,
but I searched the web now for a day, tried dozens of options but I am still stuck.

I use mac OSX 10.7.4 (yes I know, but I have too much on it to move to a complete new version) with MAMP 3.5.1 installed.
I created .bash_profile (it was automatically saved to my administrator account root folder)
Command: which php - still tells /usr/bin/php
Command: source ~/.bash_profile tells export: Command not found

That is weird. Do I need to move .bash_profile to another location/folder? What should be (in a normal case) the path to .bash_profile?

I even tried to use other bash files like ~/.bash_aliases or ~/.bashrc Both files throw a Command not found

Yet, I once tried this option in my .bash_profile:


> PHP_VERSION=`ls /Applications/MAMP/bin/php/ | sort -n | tail -1`
> export PATH=/Applications/MAMP/bin/php/${PHP_VERSION}/bin:$PATH

and this, after using source ~/.bash_profile, gave me:

PHP_VERSION=php5.6.10: Command not found.
PHP_VERSION: Undefined variable.

Interesting, because php5.6.10 is used by MAMP, in contrary to 5.3.2 (mac's own apache.

So, what am I missing here? ???

Thank you for your patience reading my misery.

Hi there all.
Perhaps it's really just my own stupidity,
but I searched the web now for a day, tried dozens of options but I am still stuck.

I use mac OSX 10.7.4 (yes I know, but I have too much on it to move to a complete new version) with MAMP 3.5.1 installed.
I created .bash_profile (it was automatically saved to my administrator account root folder)
Command: which php - still tells /usr/bin/php
Command: source ~/.bash_profile tells export: Command not found

That is weird. Do I need to move .bash_profile to another location/folder? What should be (in a normal case) the path to .bash_profile?

I even tried to use other bash files like ~/.bash_aliases or ~/.bashrc Both files throw a Command not found

Yet, I once tried this option in my .bash_profile:


> PHP_VERSION=`ls /Applications/MAMP/bin/php/ | sort -n | tail -1`
> export PATH=/Applications/MAMP/bin/php/${PHP_VERSION}/bin:$PATH

and this, after using source ~/.bash_profile, gave me:

PHP_VERSION=php5.6.10: Command not found.
PHP_VERSION: Undefined variable.

Interesting, because php5.6.10 is used by MAMP, in contrary to 5.3.2 (mac's own apache.

So, what am I missing here? ???

Thank you for your patience reading my misery.

@renegaders

This comment has been minimized.

Show comment Hide comment
@renegaders

renegaders Aug 4, 2017

Update:

> [000-000-0-0:] MEE% source ~/.bash_profile
> export: Command not found.
> [000-000-0-0:] MEE% source .bash_profile
> source: Command not found.
> [000-000-0-0:~] MEE% source Users/MEE/.bash_profile
> Users/MEE/.bash_profile: No such file or directory.
> [000-000-0-0:~] MEE% /MEE/.bash_profile
> /MEE/.bash_profile: Command not found.
> [000-000-0-0:~ MEE% source /MEE/.bash_profile
> /MEE/.bash_profile: No such file or directory.
> [000-000-0-0:~] MEE% source MEE/.bash_profile
> MEE/.bash_profile: No such file or directory.
> [000-000-0-0:~] MEE% source /Users/MEE/.bash_profile
> export: Command not found.
> [000-000-0-0:~] MEE% source Users/MEE/.bash_profile
> Users/MEE/.bash_profile: No such file or directory.
> [000-000-0-0:~] MEE% 

But .bash_profile IS there, at /Users/MEE/.bash_profile !
[000-000-0-0:~] MEE% ls -a | grep .bash_profile
.bash_profile


> Did a little more trials:
> [000-000-0-0:~] MEE% source . /.bash_profile

Now Look At This:!
> [000-000-0-0:~] MEE% ./.bash_profile
> ./.bash_profile: Permission denied.
!!!

> [000-000-0-0:~] MEE% source ./.bash_profile
> export: Command not found.
> [000-000-0-0:~] MEE% which php
> /usr/bin/php
> [000-000-0-0:~] MEE% 
> 

While:

[000-000-0-0:~] MEE% open ~/.bash_profile
[000-000-0-0:~] MEE% 

Opens up the file nicely in my text editor and showing the path to php:
export PATH="/Applications/MAMP/bin/php/php5.6.10/bin:$PATH"

What's Going On (is a song, too, :))
???

renegaders commented Aug 4, 2017

Update:

> [000-000-0-0:] MEE% source ~/.bash_profile
> export: Command not found.
> [000-000-0-0:] MEE% source .bash_profile
> source: Command not found.
> [000-000-0-0:~] MEE% source Users/MEE/.bash_profile
> Users/MEE/.bash_profile: No such file or directory.
> [000-000-0-0:~] MEE% /MEE/.bash_profile
> /MEE/.bash_profile: Command not found.
> [000-000-0-0:~ MEE% source /MEE/.bash_profile
> /MEE/.bash_profile: No such file or directory.
> [000-000-0-0:~] MEE% source MEE/.bash_profile
> MEE/.bash_profile: No such file or directory.
> [000-000-0-0:~] MEE% source /Users/MEE/.bash_profile
> export: Command not found.
> [000-000-0-0:~] MEE% source Users/MEE/.bash_profile
> Users/MEE/.bash_profile: No such file or directory.
> [000-000-0-0:~] MEE% 

But .bash_profile IS there, at /Users/MEE/.bash_profile !
[000-000-0-0:~] MEE% ls -a | grep .bash_profile
.bash_profile


> Did a little more trials:
> [000-000-0-0:~] MEE% source . /.bash_profile

Now Look At This:!
> [000-000-0-0:~] MEE% ./.bash_profile
> ./.bash_profile: Permission denied.
!!!

> [000-000-0-0:~] MEE% source ./.bash_profile
> export: Command not found.
> [000-000-0-0:~] MEE% which php
> /usr/bin/php
> [000-000-0-0:~] MEE% 
> 

While:

[000-000-0-0:~] MEE% open ~/.bash_profile
[000-000-0-0:~] MEE% 

Opens up the file nicely in my text editor and showing the path to php:
export PATH="/Applications/MAMP/bin/php/php5.6.10/bin:$PATH"

What's Going On (is a song, too, :))
???

@jeffersongouveia

This comment has been minimized.

Show comment Hide comment
@jeffersongouveia

jeffersongouveia Aug 15, 2017

Many thanks man :)

Many thanks man :)

@fernandopedro

This comment has been minimized.

Show comment Hide comment
@fernandopedro

fernandopedro Aug 18, 2017

Thanks a lot @Narayanareddy96, your solution work fine here

Thanks a lot @Narayanareddy96, your solution work fine here

@jrran90

This comment has been minimized.

Show comment Hide comment
@jrran90

jrran90 Aug 20, 2017

@cord many thanks ;)

jrran90 commented Aug 20, 2017

@cord many thanks ;)

@tinhochu

This comment has been minimized.

Show comment Hide comment
@tinhochu

tinhochu Aug 25, 2017

Thanks!

Thanks!

@alongopenroad

This comment has been minimized.

Show comment Hide comment
@alongopenroad

alongopenroad Oct 23, 2017

Awesome! Thx!

Awesome! Thx!

@sdelrue

This comment has been minimized.

Show comment Hide comment
@sdelrue

sdelrue Nov 6, 2017

I had a similar issue, turns out the order in which I was setting the PATH var was the problem:
ok:
export PATH="/usr/local/php5/bin:/usr/bin:$PATH"

not ok:
export PATH="/usr/bin:/usr/local/php5/bin:$PATH"
I had a php bin in both folders...

So make sure that the folder with the correct php version is placed first in the PATH variable

sdelrue commented Nov 6, 2017

I had a similar issue, turns out the order in which I was setting the PATH var was the problem:
ok:
export PATH="/usr/local/php5/bin:/usr/bin:$PATH"

not ok:
export PATH="/usr/bin:/usr/local/php5/bin:$PATH"
I had a php bin in both folders...

So make sure that the folder with the correct php version is placed first in the PATH variable

@jedlovescpe2

This comment has been minimized.

Show comment Hide comment
@jedlovescpe2

jedlovescpe2 Nov 12, 2017

It works! Thanks.

Just the cURL command only gives the error that /bin isn't writable.

But not a problem as I already installed the composer just before fixing my PHP version. Just like to know what's the error of the command.
$ curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

All settings correct for using Composer
The installation directory "/usr/local/bin" is not writable

jedlovescpe2 commented Nov 12, 2017

It works! Thanks.

Just the cURL command only gives the error that /bin isn't writable.

But not a problem as I already installed the composer just before fixing my PHP version. Just like to know what's the error of the command.
$ curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

All settings correct for using Composer
The installation directory "/usr/local/bin" is not writable

@catalincislariu

This comment has been minimized.

Show comment Hide comment
@catalincislariu

catalincislariu Nov 19, 2017

thanks

thanks

@mapplics

This comment has been minimized.

Show comment Hide comment
@mapplics

mapplics Jan 8, 2018

thanks man! works like a charm!

mapplics commented Jan 8, 2018

thanks man! works like a charm!

@Vladanyes

This comment has been minimized.

Show comment Hide comment
@Vladanyes

Vladanyes Jan 30, 2018

Thanks bro!!

Thanks bro!!

@preciousgeorge

This comment has been minimized.

Show comment Hide comment
@preciousgeorge

preciousgeorge Mar 13, 2018

@Narayanareddy96 your solution was the only one that worked. Thanks man.

@Narayanareddy96 your solution was the only one that worked. Thanks man.

@madhurikulkarni

This comment has been minimized.

Show comment Hide comment
@madhurikulkarni

madhurikulkarni Mar 13, 2018

@irazasyed.. That was the right and a very simple solution. Solved a lot of errors including the intl missing extension with MAMP PRO.

@irazasyed.. That was the right and a very simple solution. Solved a lot of errors including the intl missing extension with MAMP PRO.

@TopCheff

This comment has been minimized.

Show comment Hide comment
@TopCheff

TopCheff Mar 16, 2018

puedo tener más de una versión php instalada en MAMP y poder seleccionar la que más me convenga?

puedo tener más de una versión php instalada en MAMP y poder seleccionar la que más me convenga?

@omadoyeabraham

This comment has been minimized.

Show comment Hide comment
@omadoyeabraham

omadoyeabraham Mar 26, 2018

Years down the line, and this just saved me a whole lot of "googling". Thanks a lot

Years down the line, and this just saved me a whole lot of "googling". Thanks a lot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment