Cannot install sage on macOS Catalina 10.15.6

using composer (global install) 2.3.5
composer -vvv about
Running 2.3.5 (2022-04-13 16:43:00) with PHP 7.3.11 on Darwin / 19.6.0

I tried under flywheel local and mamp to install sage several times. One time according to docs into a bedrock install (bedrock installed just fine) and another time into a normal WP 5.9.3 setup.

Terminal output begins with:

  • composer create-project roots/sage mySageTheme

  • Creating a “roots/sage” project at “./mySageTheme”

  • Info from https://repo.packagist.org: #StandWithUkraine

  • Installing roots/sage (9.0.10)

    • Installing roots/sage (9.0.10): Extracting archive
  • Created project in /Applications/MAMP/htdocs/wordpress/wp-content/themes/mySageTheme

  • Installing dependencies from lock file (including require-dev)

  • Verifying lock file contents can be installed on current platform.

  • Package operations: 33 installs, 0 updates, 0 removals

Then comes the following info:

  • Installing kylekatarnls/update-helper (1.2.1): Extracting archive
    kylekatarnls/update-helper contains a Composer plugin which is currently not in your allow-plugins config. See Config - Composer
    Do you trust “kylekatarnls/update-helper” to execute code and wish to enable it now? (writes “allow-plugins” to composer.json) [y,n,d,?]y
  • Installing composer/installers (v1.9.0): Extracting archive
    composer/installers contains a Composer plugin which is currently not in your allow-plugins config. See Config - Composer
    Do you trust “composer/installers” to execute code and wish to enable it now? (writes “allow-plugins” to composer.json) [y,n,d,?] y
  • Installing symfony/translation-contracts (v2.3.0): Extracting archive
  • Installing symfony/polyfill-mbstring (v1.20.0): Extracting archive
  • Installing symfony/translation (v4.4.16): Extracting archive
  • Installing nesbot/carbon (1.25.3): Extracting archive
  • Installing psr/simple-cache (1.0.1): Extracting archive
  • Installing psr/container (1.0.0): Extracting archive
  • Installing illuminate/contracts (v5.6.39): Extracting archive
  • Installing doctrine/inflector (1.4.3): Extracting archive
  • Installing illuminate/support (v5.6.39): Extracting archive
  • Installing illuminate/container (v5.6.39): Extracting archive
  • Installing illuminate/events (v5.6.39): Extracting archive
  • Installing paragonie/random_compat (v9.99.99): Extracting archive
  • Installing symfony/process (v3.4.46): Extracting archive
  • Installing symfony/polyfill-ctype (v1.20.0): Extracting archive
  • Installing ramsey/uuid (3.9.3): Extracting archive
  • Installing symfony/finder (v4.4.16): Extracting archive
  • Installing illuminate/filesystem (v5.6.39): Extracting archive
  • Installing symfony/service-contracts (v2.2.0): Extracting archive
  • Installing symfony/polyfill-php80 (v1.20.0): Extracting archive
  • Installing symfony/polyfill-php73 (v1.20.0): Extracting archive
  • Installing symfony/console (v4.4.16): Extracting archive
  • Installing illuminate/console (v5.6.39): Extracting archive
  • Installing roots/sage-installer (1.6.3): Extracting archive
  • Installing psr/log (1.1.3): Extracting archive
  • Installing symfony/debug (v4.4.16): Extracting archive
  • Installing illuminate/view (v5.6.39): Extracting archive
  • Installing illuminate/config (v5.6.39): Extracting archive
  • Installing roots/sage-lib (9.0.9): Extracting archive
  • Installing brain/hierarchy (2.5.0): Extracting archive
  • Installing soberwp/controller (2.1.2): Extracting archive
  • Installing squizlabs/php_codesniffer (2.9.2): Extracting archive
    Generating autoload files
    Carbon 1 is deprecated, see how to migrate to Carbon 2.
    https://carbon.nesbot.com/docs/#api-carbon-2
    You can run ‘./vendor/bin/upgrade-carbon’ to get help in updating carbon and other frameworks and libraries that depend on it.
    14 packages you are using are looking for funding.
    Use the composer fund command to find out more!

Roots\Sage\Installer\ComposerScript::postCreateProject

and finally:

In Process.php line 143:

[TypeError]
Argument 1 passed to Symfony\Component\Process\Process::__construct() must
be of the type array, string given, called in /Applications/MAMP/htdocs/wor
dpress/wp-content/themes/mySageTheme/vendor/roots/sage-installer/src/Compos
erScript.php on line 26

Exception trace:
at phar:///usr/local/bin/composer/vendor/symfony/process/Process.php:143
Symfony\Component\Process\Process->__construct() at /Applications/MAMP/htdocs/wordpress/wp-content/themes/mySageTheme/vendor/roots/sage-installer/src/ComposerScript.php:26
Roots\Sage\Installer\ComposerScript::postCreateProject() at phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:391
Composer\EventDispatcher\EventDispatcher->executeEventPhpScript() at phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:248
Composer\EventDispatcher\EventDispatcher->doDispatch() at phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:125
Composer\EventDispatcher\EventDispatcher->dispatchScript() at phar:///usr/local/bin/composer/src/Composer/Command/CreateProjectCommand.php:321
Composer\Command\CreateProjectCommand->installProject() at phar:///usr/local/bin/composer/src/Composer/Command/CreateProjectCommand.php:167
Composer\Command\CreateProjectCommand->execute() at phar:///usr/local/bin/composer/vendor/symfony/console/Command/Command.php:298
Symfony\Component\Console\Command\Command->run() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:1015
Symfony\Component\Console\Application->doRunCommand() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:299
Symfony\Component\Console\Application->doRun() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:334
Composer\Console\Application->doRun() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:171
Symfony\Component\Console\Application->run() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:130
Composer\Console\Application->run() at phar:///usr/local/bin/composer/bin/composer:88
require() at /usr/local/bin/composer:29

what’s wrong??

Ok, I figured something out. Installation of sage 9 fails because of my composer version. I had 2.3.5. Deleted that and installed composer 2.0.14 and it worked.

Install composer:

Sage9 installation works with an older Version of composer. I used 2.0.14. the latest one results in an error.

You should setup the complete project (including Bedrock) with this version of composer.

Eventually delete your old composer version:

Thus write in terminal:

  1. php -r "copy(‘https://getcomposer.org/installer’, ‘composer-setup.php’);“

  2. IMPORTANT: Check this website for an up to date hash: Composer

  3. php -r "if (hash_file(‘sha384’, ‘composer-setup.php’) === ‘USE UP TO DATE HASH’) { echo ‘Installer verified’; } else { echo ‘Installer corrupt’; unlink(‘composer-setup.php’); } echo PHP_EOL;“

  4. php composer-setup.php —version=2.0.14

  5. php -r "unlink(‘composer-setup.php’);“

Then Follow this: How to install Composer globally on Mac OS

Caveat: there is no .zshrc file in the user directory in Catalina. It is in /etc/

Hi @marjan — are you trying to install Sage 9.x on purpose? Running composer create-project roots/sage installs the latest published version of Sage 10, which is currently v10.1.6.

Sage 9 is no longer receiving updates and Sage 10 became stable on 2022-03-01, but it requires PHP 7.4 or PHP 8. Since you’re running PHP 7.3, you are not downloading the most recent major version of Sage.

Sure, version 10 installed. I was just wondering why version 9 failed. And must tutorials on YouTube are showing version 9.