PHP version issue when installing Craft 3 using Composer Why do I get the error when I try to install Craft 3?

composer create-project craftcms/craft Documents/Development/Project -s beta


The error:

[InvalidArgumentException]                                                                                           
Could not find package craftcms/craft with stability stable 
in a version installable using your PHP version 5.6.30.


I am running PHP 7.1.
You are running PHP 5.6.30 on the command line (read the error message), which you can also verify with php -v.

To swap the PHP, you should add the path to your preferred PHP executable to your shell’s configuration file (e.g. ~/.bash_profile, ~/.bashrc, ~/.zshrc).

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


Another option is to ignore the PHP requirement using --ignore-platform-reqs

composer create-project craftcms/craft . -s beta --ignore-platform-reqs


and then fake the PHP version in the project’s composer.json for later updates

"config": {
  "optimize-autoloader": true,
  "platform": {"php": "7.0"}
},