WP-CLI not working from Bash script

The reason is because the cron script’s environment has minimal configuration. When you as a user log into your system, additional environment variable are set which allow you to execute programs without explicitly defining the full path.

The best way to fix this is to define the full path to your program(s) in your cron script. This is generally best practice even for system calls. For example if your wp resides in /usr/local/bin, modify your cron script:

/usr/local/bin/wp core download
/usr/local/bin/wp core config --dbname=dbname --dbuser=root --dbpass=root
/usr/local/bin/wp db create
/usr/local/bin/wp core install --url="http://localhost:8888/folder" --title="name" --    admin_user="admin" --admin_password="password" --admin_email="[email protected]"