2

I updated the to MacOS Big Sur and then switched to MAMP Pro 6.3 from MAMP 4.x.

which php commands results the

usr/php/bin/

I updated the path using following. vim ~/.bash_profile

export PATH=/Applications/MAMP/bin/php/php7.4.12/bin:$PATH export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"

Press esc and then :wq

source ~/.bash_profile

Now when I do which php it shows MAMP's php7.4.12 but if close and re-open the terminal, it again says

usr/php/bin

Btw, PHP 7.4.12 is set as Default version in MAMP Pro from PHP settings in MAMP Pro.

Versoins

  • macOS Big Sur version 11.1
  • MAMAP 6.3
sohaib
  • 179
  • 2
  • 6
  • 1
    SOLUTION: Mac Big Sur uses "zsh" Oh-my-zosh for terminal. so, I did the following. 1. open terminal. 2. check if you have .zshrc file in your profile path (/Users/yourProfileName) 3. if you don't have .zshrc file, create one using (~ touch .zshrc) commamd. 4. add these lines: export MAMP_PHP=/Applications/MAMP/bin/php/php7.4.12/bin export PATH="$MAMP_PHP:$PATH" 5. save the file. close the terminal and reopen it. Now run "which php" . – sohaib Jan 19 '21 at 06:52
  • Question: I'm considering upgrading to Big Sur too. Was the upgrade of MAMP 4.x to 6 necessary due to the MAC being updated to Big Sur? If so, which MAC OS did you upgrade from where MAMP 4.x was working ok? Or did MAMP PRO 4.x work ok on Big Sur and you just wanted to go to 6? – jkincali May 24 '21 at 02:06

2 Answers2

1

Since you're using MAMP PRO 6.x you can enable Activate command line shortcuts for the selected PHP version, pear & pecl within the MAMP PHP settings. This will add aliases to your .profile file. If this does not work right away find the .zshrc file if you have it and add source ~/.profile; within it.

Carbon
  • 36
  • 1
  • 7
1
    • Open a terminal.
    • edit this file:
nano .zshrc  
    • add these two lines:
export MAMP_PHP=/Applications/MAMP/bin/php/php7.4.12/bin 
export PATH="$MAMP_PHP:$PATH" 

NOTE: if you want another version, replace php7.4.12 for the version you want.

    • Save the changes o file and then close the terminal and reopen it.
    • Now run "which php" and you will see the desire version of Php.
Ale DC
  • 1,646
  • 13
  • 20