laravel 如何使用 .zshrc 将 ~/.composer/vendor/bin 目录放在 PATH 中

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/27258930/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 10:30:17  来源:igfitidea点击:

How do I place the ~/.composer/vendor/bin directory in your PATH using .zshrc

laravelzsh

提问by xslibx

This may be a very noob question, but I'm trying to install Homestead on my Mac. I'm following installation steps via http://laravel.com/docs/4.2/homesteadhowever there is a point in the installation process where it state "Make sure to place the ~/.composer/vendor/bin directory in your PATH so the homestead executable is found when you run the homestead command in your terminal." How do I do this using zsh? Thanks!

这可能是一个非常菜鸟的问题,但我正在尝试在我的 Mac 上安装 Homestead。我正在通过http://laravel.com/docs/4.2/homestead执行安装步骤,但是在安装过程中有一点说明“确保将 ~/.composer/vendor/bin 目录放在您的 PATH 中所以当你在终端中运行 homestead 命令时,可以找到 homestead 可执行文件。” 我如何使用 zsh 做到这一点?谢谢!

回答by Paul

in whichever profile you're using (.zprofile or .profile or whatever), you would add the line:

在您使用的任何配置文件(.zprofile 或 .profile 或其他)中,您将添加以下行:

export PATH = ~/.composer/vendor/bin:$PATH

then reload your profile

然后重新加载您的个人资料

source ~/.zprofile

回答by Joel

Update the file ~/.bashrc like this:

像这样更新文件 ~/.bashrc:

PATH="~/.composer/vendor/bin:{$PATH}"

回答by rust

If your PATH is in .bashrcfile :

如果您的 PATH 在.bashrc文件中:

echo 'export PATH="$PATH:$HOME/.composer/vendor/bin"' >> ~/.bashrc

If your PATH is in .zshrcfile :

如果您的 PATH 在.zshrc文件中:

echo 'export PATH="$PATH:$HOME/.composer/vendor/bin"' >> ~/.zshrc

Finally, you should restart your environment

最后,您应该重新启动您的环境

source .bashrc #Bash

source .bashrc #Bash

source .zshrc #ZSH

source .zshrc #ZSH

回答by James W.

In one of your start files within home directory (~/.bashrc or ~/.zshrc)

在主目录(~/.bashrc 或 ~/.zshrc)中的一个启动文件中

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