You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

MacOS Mojave下ZSH提示laravel: command not found问题求助

Fixing "zsh: command not found: laravel" on macOS Mojave with ZSH

Hey there, let's work through this Laravel command issue you're facing. I've dealt with similar PATH-related headaches on macOS before, so here are actionable steps to get it sorted:

  • First, confirm the Laravel Installer is actually installed
    Run this command to check if the Laravel executable exists in your Composer vendor bin directory:

    ls ~/.composer/vendor/bin
    

    If you don't see laravel in the output, the installer isn't installed yet. Fix that by running:

    composer global require laravel/installer
    
  • Clean up your duplicate PATH entries
    Your ~/.zshrc has repeated entries for your Composer vendor bin path (both /Users/harshamv/.composer/vendor/bin and $HOME/.composer/vendor/bin are the same location). While this doesn't break things, it's messy and can lead to confusion. Replace those three PATH lines with a single, consolidated one:

    export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:$HOME/.composer/vendor/bin:$PATH"
    
  • Refresh your ZSH configuration
    After editing ~/.zshrc, you need to load the new config immediately. Run:

    source ~/.zshrc
    

    Alternatively, close and reopen your terminal to make sure changes stick.

  • Verify your PATH is correctly set
    Double-check that your Composer vendor bin path is in your active PATH by running:

    echo $PATH
    

    Look for /Users/harshamv/.composer/vendor/bin in the output—if it's missing, go back and confirm your ~/.zshrc edits were saved correctly.

  • Fix file permissions if needed
    Sometimes the Laravel executable might lack the necessary run permissions. Fix that with:

    chmod +x ~/.composer/vendor/bin/laravel
    
  • Temporary workaround if all else fails
    While we want the global laravel command working, you can still create a new Laravel project directly via Composer in the meantime:

    composer create-project laravel/laravel your-project-name
    

内容的提问来源于stack exchange,提问作者Harsha M V

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.14 08:10:35