Hi everybody. I just tried out the CLI. I followed the instruction on github – at least like I understand what’s written there
- I opened my terminal an run
composer global require getkirby/cli
composer -n config --global home
- I opened a current project and
kirby install and
kirby version → works
But now if i switch to another project or close the terminal I have to redo the 3. step.
This works but seems quite awkward. Is this the way? What exactly is happening on step 3?
Sorry for asking. I’m familiar with the Terminal for stuff like
npm run dev but I never use composer. And my English is a little lame.
PATH environment variable tells your shell (the terminal) where to find executables.
With the above command you are setting PATH to
"~/.composer/vendor/bin" plus what is already in PATH.
Essentially you are prepending the folder “~/.composer/vendor/bin” to it.
~ is a shortcut for your home folder (something like
This way the terminal knows it has to look for executable files also in the folder into which composer installed the
kirby cli program. This allows you to just write
kirby in the terminal, instead of having to write out the whole path
~/.composer/vendor/bin/kirby every time.
However, when you close the terminal or open a new one, the
PATH variable is reset. And the shell does no longer know it has to search
kirby in that folder.
You can however make it so that the above command is automatically executed every time you open a terminal, by adding it to a script that is automatically executed either every time you open a terminal, or simply once when you login.
I personally don’t use osx, but if I understand it correctly, one such script would be the
.zshrc file in your home folder (e.g
/Users/jwssnr). Please refer to this StackExchange answer in regards to scripts that are automatically executed: macos - ZSH: .zprofile, .zshrc, .zlogin - What goes where? - Ask Different
Thank you so much for your time.
Now I understand what this Path thing does. And that it’s meant to be like it is.
Was really insecure.
It’s not that hard to handle this 2 lines to bring kirby CLI to the current path.
So I’ll stick with this.