If you were to run statamic
in your terminal, it would have no idea you meant the one you just installed with Composer.
$ statamic new mysiteCommand not found: statamic
You could use the full path to the binary instead:
$ ~/.composer/vendor/bin/statamic new mysiteBuilding a new statamic site.
But that's silly. Who wants to do that every time?
You can solve this by adding Composer's bin
directory to your PATH
(sometimes seen as $PATH
).
MacOS or Linux
Find out what shell you're using by running echo $SHELL
.
- If it's
bash
, create a~/.bashrc
file. - If it's
zsh
, create a~/.zshrc
file.
Then add this to the end of it:
export PATH=${PATH}:~/.composer/vendor/bin
To test it, open a new terminal window and run echo $PATH
. You should see the composer directory at the end.
Windows
To add to your PATH
on Windows, it requires you to click through some things. Ryan Hoffman has written an article with screenshots to walk you through it.
Composer's directory to add is %USERPROFILE%\AppData\Roaming\Composer\vendor\bin
.