Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

souleye's avatar

problem creating a laravel app with command 'laravel new'

I managed to install laravel on my mac osx 10.75 but after everything was set, I tried to initiate a new app with the command 'laravel new app_name' I get the error message '-bash: laravel: command not found'. I checked everything and everything seems fine but I don'l have a clue why I'm getting that message. it seems other developers on linux/unix systems have had similar issues. any help will be appreciated. thanks. souleye

0 likes
6 replies
phildawson's avatar

I think you missed this bit

Make sure to place the ~/.composer/vendor/bin directory in your PATH so the laravel executable can be located by your system.

edit

~/.bash_profile

add

export PATH="/Users/yourusername/.composer/vendor/bin:$PATH"

save reopen Terminal

1 like
souleye's avatar

thanks @phildawson but I think that I did everything that I was asked to do. and I placed a few variations of that code into my .bash_profile, like so 'export PATH=~/.composer/vendor/bin/:$PATH' (without the quotes) but it's still not working.

souleye's avatar

@phildawson I have apparently found the solution here: I think the laravel command is an alias to the actual composer command to create a new project. Try using 'composer create-project laravel/laravel [insert_project_name]' instead. when I tried it, I didn't get an error message and I got feedback 'Created project in my app' and then, it installed a bunch of stuff. I'm gonna check later but I guess this resolved the issue. thanks again.

souleye's avatar

the only thing that worked apparently is the composer command composer create-project laravel/laravel [insert_project_name]. now when I cd to laravel, I can display this: admins-Mac-Pro-2:~ admin$ cd ~/.composer/vendor/bin/laravel/ admins-Mac-Pro-2:laravel admin$ ls app composer.lock package.json readme.md tests artisan config phpspec.yml resources vendor bootstrap database phpunit.xml server.php composer.json gulpfile.js public storage admins-Mac-Pro-2:laravel admin$

Please or to participate in this conversation.