While Installing WordPress on Mac, you will encounter this error with message “Unable to write to wp-config.php file. You can create the wp-config.php file manually and paste the following text into it.”
To Fix this error,
First go inside Applications > XAMPP > xamppfiles >htdocs > wp-config.php
Then open wordpress folder inside htdocs folder.
There you will find wp-config-sample.php file.
Now rename this wp-config-sample.php into wp-config.php.
Then open this file in VSCode or any code editor.
Now, just copy the file Configuration rules for wp-config.php from the error page as highlighted below. Copy all part by just selecting with Ctrl + A.