【问题标题】:Add folder to environment variable将文件夹添加到环境变量
【发布时间】:2012-06-19 19:01:09
【问题描述】:

目前我正在尝试安装 Zend 框架。该框架带有一个命令行工具,zf.sh 用于 *nix 系统,zf.bat 用于 Windows 系统。为了使用zf.sh,我尝试将它添加到我的环境路径中。不知怎的,我无法让它工作。

我的~/.profile

export PATH=$PATH:/Applications/MAMP/bin/php/php5.3.6/bin/

export ZEND=/Applications/MAMP/bin/php/php5.3.6/bin/zf.sh

# 2012-06-05 make alias for zf
# Make an alias for the zf.sh so we can call it with zf instead of zf.sh
alias zf=/Applications/MAMP/bin/php/php5.3.6/bin/zf.sh

# Add the path to the Zend files so that the zf.sh can work with them
ZEND_TOOL_INCLUDE_PATH=/Applications/MAMP/bin/php/php5.3.6/lib/php/Zend

我的/etc/paths

/usr/bin
/bin
/usr/sbin
/sbin
/usr/local/bin
~/Development/play-2.0
/Applications/Racket\ v5.2/bin/
/Applications/MAMP/bin/php/php5.3.6/bin/

但是当我这样做时echo $PATH

/usr/bin /bin /usr/sbin /sbin /usr/local/bin /usr/X11R6/bin

zf

fish: Unknown command 'zf'

【问题讨论】:

    标签: macos zend-framework osx-lion environment-variables


    【解决方案1】:

    alias zf='/var/www/zf1_trunk/bin/zf.sh' 添加到.bash_profile 应该可以让您访问zf 命令行

    at ~/.bash_profile
    alias zf='/var/www/zf1_trunk/bin/zf.sh'
    

    【讨论】:

    • 但是我必须将行更改为我的 zf.sh 位置对吗?所以就我而言,.bash_profile, alias zf='/Applications/MAMP/bin/php/php5.3.6/bin/zf.sh'
    【解决方案2】:

    如果您在 MAC OS X 中使用 MAMP

    1. 打开终端
    2. 在终端类型“vi .bash_profile”中
    3. 在编辑器中输入该行

    别名zf='/Applications/MAMP/bin/php/php5.3.6/bin/zf.sh'

    更改位置符合。到您的软件安装

    1. 出口终端
    2. 打开终端,然后输入 zf

    【讨论】:

      【解决方案3】:

      通常,OSX 上的 bash 使用 .bash_profile,而不是 .profile...查看它是否正确获取它。

      【讨论】:

      • 我把文件名形式.profile改成了.bash_profile,但是好像还是不行!
      • 哪里有不该有的空格?
      • 您的 PATH 应采用以下形式:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11R6/bin ... 否则,它只会在 /usr/bin 中查找二进制文件 :-)
      猜你喜欢
      • 2014-10-23
      • 1970-01-01
      • 1970-01-01
      • 2020-06-08
      • 2019-12-17
      • 2014-12-17
      • 2017-10-31
      • 1970-01-01
      • 2018-02-09
      相关资源
      最近更新 更多