Skip to content

Instantly share code, notes, and snippets.

@Irvyne
Last active August 24, 2020 01:47
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save Irvyne/8014279 to your computer and use it in GitHub Desktop.
Save Irvyne/8014279 to your computer and use it in GitHub Desktop.
Use mamp php in cli (using an alias)

Use mamp php in cli (using an alias)

Open a terminal and type php -v to see the current version of php.

Determine the path for the wanted php version of mamp (YOUR VERSION ON YOUR COMPUTER!)

  • example : /Applications/MAMP/bin/php/php5.x.x/bin/php

Type in the terminal cd ~ to change the current directory (in your home)

Then, type nano .bash_profile to open an editor in your terminal

Type alias php='/Applications/MAMP/bin/php/php5.x.x/bin/php', don't forget to replace the php version

Now, you must save the file so press CTRL+X, then type Y and finally type Enter

You must restart (stop && start || close && open) your terminal and type php -v again

You now use the php version of mamp when you type php in the terminal

@oliveratgithub
Copy link

Works like a charm, thanks a lot!

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