Setting up the specified environment on a Mac can be broken down into several steps. Below are the steps to help you set up the requirements on a macOS system:
-
Install Homebrew (if not already installed):
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
-
Install PHP 7.4 and extensions:
brew install [email protected]
Once installed, you can install the extensions:
brew install [email protected] [email protected]
(The other extensions mentioned, such as xml, json, zip, iconv, gd, fileinfo, openssl, and simplexml are usually bundled with the core PHP distribution. So you won't need to install them separately.)
-
Change PHP settings:
To update the
max_input_vars
, you'll have to modify thephp.ini
file. Find its location:php --ini
Open the provided
php.ini
location with a text editor, e.g.,nano /usr/local/etc/php/7.4/php.ini
Search for
max_input_vars
and change its value to 5000. If the line doesn't exist, add it:max_input_vars = 5000
Save the changes and exit the editor.
-
Install MySQL:
For simplicity, I'm demonstrating with MariaDB, but the process would be similar for other distributions:
brew install mariadb
Start the MariaDB service:
brew services start mariadb
-
Install Node and Yarn:
brew install node brew install yarn
-
Install Bower:
Since Bower is installed via npm (which comes with Node):
npm install -g bower
-
Install Composer:
It's mentioned that there were problems with Composer v2+ on Windows. However, on Mac, the latest version of Composer should be fine. If you do encounter issues, you can specifically install version 1.10:
brew install composer
To install a specific version:
composer self-update 1.10
(Note: If in the future, you decide to revert to the latest version, just run
composer self-update
.) -
Ensure your PATH is set correctly:
To use these tools easily from the command line, you'll want to ensure they're available in your
PATH
. For instance, if you installed PHP through Homebrew, add this to your~/.zshrc
or~/.bash_profile
(depending on your shell):export PATH="/usr/local/opt/[email protected]/bin:$PATH" export PATH="/usr/local/opt/[email protected]/sbin:$PATH"
Then, load the changes:
source ~/.zshrc
Or, if you use bash:
source ~/.bash_profile
-
Restart services:
If you made changes to PHP settings or installed services, ensure you restart them to have the new configurations take effect.
-
Check installations:
It's a good idea to check if everything is correctly installed:
php -v mysql --version node -v yarn -v bower --version composer --version
That should get you up and running with the specified requirements on your Mac. If you encounter any issues during the setup process, always refer to the official documentation or community forums for troubleshooting.