{"id":13389,"date":"2025-09-10T07:06:32","date_gmt":"2025-09-10T07:06:32","guid":{"rendered":"https:\/\/www.bacancytechnology.com\/qanda\/?p=13389"},"modified":"2025-09-10T07:06:32","modified_gmt":"2025-09-10T07:06:32","slug":"laravel-command-not-found","status":"publish","type":"post","link":"https:\/\/www.bacancytechnology.com\/qanda\/laravel\/laravel-command-not-found","title":{"rendered":"Laravel Command Not Found"},"content":{"rendered":"<p>This article provides a comprehensive guide to resolving the &#8220;laravel command not found&#8221; error, a common issue faced by developers after installing the Laravel installer globally using Composer. It outlines the root cause of the problem and offers detailed, platform-specific solutions for macOS, Linux, and Windows, ensuring you can successfully execute Laravel commands from your terminal.<\/p>\n<p><strong>After running:<\/strong><\/p>\n<pre class=\"lang:adddarkplain\">composer global require laravel\/installer<\/pre>\n<p><strong>when executing:<\/strong><\/p>\n<pre class=\"lang:adddarkplain\">laravel<\/pre>\n<p><strong>you receive:<\/strong><\/p>\n<pre class=\"lang:adddarkplain\">-bash: laravel: command not found<\/pre>\n<h2>Root Cause<\/h2>\n<p>The laravel executable is installed in Composer\u2019s global vendor\/bin directory (commonly ~\/.config\/composer\/vendor\/bin or ~\/.composer\/vendor\/bin), which is not in your PATH. Your shell can\u2019t locate the executable.<\/p>\n<h2>Step\u2011by\u2011Step: Locate and Add the Directory to PATH<\/h2>\n<h3>Step 1: Locate the Composer Global Bin Path<\/h3>\n<pre class=\"lang:adddarkplain\">composer global config bin-dir --absolute<\/pre>\n<p><strong>This outputs something like:<\/strong><\/p>\n<pre class=\"lang:adddarkplain\">\/home\/your\u2011username\/.config\/composer\/vendor\/bin<\/pre>\n<p>Use this path in the following steps.<\/p>\n<h2>For Linux (Ubuntu, Debian, etc.)<\/h2>\n<h3>1. Edit your shell profile:<\/h3>\n<p><strong>If using Bash:<\/strong><\/p>\n<pre class=\"lang:adddarkplain\">nano ~\/.bashrc<\/pre>\n<p><strong>If using Zsh:<\/strong><\/p>\n<pre class=\"lang:adddarkplain\">nano ~\/.zshrc<\/pre>\n<h3>2. Add this line at the bottom:<\/h3>\n<pre class=\"lang:adddarkplain\">export PATH=\"$HOME\/.config\/composer\/vendor\/bin:$PATH\"<\/pre>\n<p>(Replace with your actual path from the previous step.)<\/p>\n<h3>3. Save and reload:<\/h3>\n<pre class=\"lang:adddarkplain\">source ~\/.bashrc<\/pre>\n<p>or<\/p>\n<pre class=\"lang:adddarkplain\">source ~\/.zshrc<\/pre>\n<h3>4. Verify:<\/h3>\n<pre class=\"lang:adddarkplain\">laravel --version<\/pre>\n<h2>For macOS<\/h2>\n<h3>1. Determine your shell:<\/h3>\n<pre class=\"lang:adddarkplain\">echo $SHELL<\/pre>\n<ul>\n<li>If output is \/bin\/zsh, edit: ~\/.zshrc<\/li>\n<li>If output is \/bin\/bash, edit: ~\/.bash_profile<\/li>\n<\/ul>\n<h3>2. Open the correct file:<\/h3>\n<pre class=\"lang:adddarkplain\">nano ~\/.zshrc\r\n(or ~\/.bash_profile)<\/pre>\n<h3>3. Add to the bottom:<\/h3>\n<pre class=\"lang:adddarkplain\">export PATH=\"$HOME\/.config\/composer\/vendor\/bin:$PATH\"<\/pre>\n<h3>4. Reload your shell:<\/h3>\n<pre class=\"lang:adddarkplain\">source ~\/.zshrc\r\n(or source ~\/.bash_profile)<\/pre>\n<h3>5. Test:<\/h3>\n<pre class=\"lang:adddarkplain\">laravel --version<\/pre>\n<h2>For Windows<\/h2>\n<h3>1. Locate the folder:<\/h3>\n<pre class=\"lang:adddarkplain\">C:\\Users\\YourUsername\\AppData\\Roaming\\Composer\\vendor\\bin<\/pre>\n<h3>2. Add to the PATH:<\/h3>\n<ul>\n<li>Open Environment Variables<\/li>\n<li>Find Path under User variables<\/li>\n<\/ul>\n<p>Click<strong> Edit \u2192 New<\/strong>, then paste:<\/p>\n<pre class=\"lang:adddarkplain\">C:\\Users\\YourUsername\\AppData\\Roaming\\Composer\\vendor\\bin<\/pre>\n<ul>\n<li>Click OK on all dialogues<\/li>\n<\/ul>\n<h3>3. Restart your terminal, then verify:<\/h3>\n<pre class=\"lang:adddarkplain\">laravel --version<\/pre>\n<h2>Troubleshooting Tips<\/h2>\n<pre class=\"lang:adddarkplain\"># Check Composer installation:\r\ncomposer --version\r\n\r\n# Confirm Laravel installer is installed globally:\r\ncomposer global show laravel\/installer\r\n\r\n# Verify your PATH:\r\necho $PATH\r\n\r\n# Confirm the directory contains the Laravel executable:\r\nls $(composer global config bin-dir --absolute)<\/pre>\n<h2>Optional: No\u2011Global Install Alternative<\/h2>\n<p>If you prefer not to modify your PATH:<\/p>\n<pre class=\"lang:adddarkplain\">npx laravel new project\u2011name<\/pre>\n<p>This will invoke the installer directly without global installation.<\/p>\n<h2>References<\/h2>\n<p><a href=\"https:\/\/laravel.com\/docs\/12.x\/installation\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\">Laravel<\/span><\/a><\/p>\n<p><a href=\"https:\/\/getcomposer.org\/doc\/03-cli.md#global\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\">Getcomposer CLI<\/span><\/a><\/p>\n<div class=\"qanda-read-box\"><div class=\"bg-light read-more-icon\"><img decoding=\"async\" src=\"https:\/\/assets.bacancytechnology.com\/qanda\/wp-content\/uploads\/2025\/04\/24061434\/read-txt.png\" alt=\"Also Read\"><p><\/p><h3>Also Read:<\/h3><a href=\"https:\/\/www.bacancytechnology.com\/blog\/laravel-performance-optimization\" target=\"_blank\">Laravel Performance Optimization<\/a><\/div><\/div>\n","protected":false},"excerpt":{"rendered":"<p>This article provides a comprehensive guide to resolving the &#8220;laravel command not found&#8221; error, a common issue faced by developers after installing the Laravel installer globally using Composer. It outlines the root cause of the problem and offers detailed, platform-specific solutions for macOS, Linux, and Windows, ensuring you can successfully execute Laravel commands from your [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":13390,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[10],"tags":[],"class_list":["post-13389","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-laravel"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.bacancytechnology.com\/qanda\/wp-json\/wp\/v2\/posts\/13389"}],"collection":[{"href":"https:\/\/www.bacancytechnology.com\/qanda\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bacancytechnology.com\/qanda\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bacancytechnology.com\/qanda\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bacancytechnology.com\/qanda\/wp-json\/wp\/v2\/comments?post=13389"}],"version-history":[{"count":1,"href":"https:\/\/www.bacancytechnology.com\/qanda\/wp-json\/wp\/v2\/posts\/13389\/revisions"}],"predecessor-version":[{"id":13391,"href":"https:\/\/www.bacancytechnology.com\/qanda\/wp-json\/wp\/v2\/posts\/13389\/revisions\/13391"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.bacancytechnology.com\/qanda\/wp-json\/wp\/v2\/media\/13390"}],"wp:attachment":[{"href":"https:\/\/www.bacancytechnology.com\/qanda\/wp-json\/wp\/v2\/media?parent=13389"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bacancytechnology.com\/qanda\/wp-json\/wp\/v2\/categories?post=13389"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bacancytechnology.com\/qanda\/wp-json\/wp\/v2\/tags?post=13389"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}