简体   繁体   English

使用PEAR与MAC OS X.

[英]using PEAR with MAC OS X

I've tried using pear to install both phpunit and phpdoc and seem to be running into a problem with my pear installation. 我已经尝试使用pear安装phpunit和phpdoc,并且似乎遇到了我的pear安装问题。

following the installation guide here : 按照安装向导在这里

  1. You can prepare your PEAR installation using the following commands: $ pear channel-discover pear.phpdoc.org 您可以使用以下命令准备PEAR安装: $ pear channel-discover pear.phpdoc.org

this gives me an error message: -bash: pear: command not found 这给了我一个错误信息: -bash: pear: command not found

I've seen mention of using $ locate bin/pear to find the installation. 我已经看到提到使用$ locate bin/pear来查找安装。 This gives me the following message: 这给了我以下信息:

WARNING: The locate database (/var/db/locate.database) does not exist.
To create the database, run the following command:

  sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist

Please be aware that the database can take some time to generate; once
the database has been created, this message will no longer appear.

Not sure what that means, but if I'm reading it correctly, it's saying that pear isn't there. 不知道这意味着什么,但如果我正确地阅读它,那就说梨不在那里。 I know my path to pear is /Applications/MAMP/bin/php/php5.3.6/bin/pear /Applications/MAMP/bin/php/php5.3.6/bin/pear . 我知道我的梨之路是/Applications/MAMP/bin/php/php5.3.6/bin/pear /Applications/MAMP/bin/php/php5.3.6/bin/pear

I'm a little lost on what to try next. 我对接下来的尝试感到有些失落。 Any suggestions on what I'm doing wrong? 关于我做错的任何建议?

Create your locate database using the command given. 使用给定的命令创建您的locate数据库。 You can think of this in terms of the way spotlight has to "load" or index everything when you first install osx. 您可以根据聚光灯首次安装osx时“加载”或索引所有内容的方式来考虑这一点。 'can take some time' usually means 'will take some time' '可能需要一些时间'通常意味着'需要一些时间'

If you know your pear path you can execute it directly: 如果你知道你的梨路径,你可以直接执行它:

/Applications/MAMP/bin/php/php5.3.6/bin/pear channel-discover pear.phpdoc.org

or add an alias to it manually in your bash profile directory http://blog.elucidcode.com/2011/03/terminal-aliases-in-os-x/ 或者在bash配置文件目录中手动添加别名http://blog.elucidcode.com/2011/03/terminal-aliases-in-os-x/

or make a link to it in /usr/bin . 或者在/usr/bin一个链接。

For an overview. 概述。 It seems pear is installed fine. 梨似乎安装得很好。 Just when you type in 'pear' into the console osx doesn't recognize that as being a command, Its like a shortcut on your desktop that doesn't point to anywhere. 正当你在控制台中输入'pear'时,osx并不认为它是一个命令,它就像桌面上的一个快捷方式,并不指向任何地方。 What needs to be done (using one of the methods above) is to point the "desktop shortcut" (the pear command) to the actually pear binary. 需要做什么(使用上述方法之一)是将“桌面快捷方式”( pear命令)指向实际的梨形二进制文件。

Try using the full path to pear: 尝试使用梨的完整路径:

$ /Applications/MAMP/bin/php/php5.3.6/bin/pear channel-discover pear.phpdoc.org

When you enter a unix command like that, the first part is the application that you want to run. 当您输入类似的unix命令时,第一部分是您要运行的应用程序。 Typing "pear" means you want to run the pear app. 键入“pear”意味着您要运行pear应用程序。 Your OS knows a few directories in which to look for applications. 您的操作系统知道一些查找应用程序的目录。 You can see what they are by entering the command: 您可以通过输入命令查看它们是什么:

echo $PATH

The list is separated by colons. 该列表以冒号分隔。 If the application you want to run is not in one of those folders, then your OS doesn't know where to find it. 如果您要运行的应用程序不在其中一个文件夹中,那么您的操作系统不知道在哪里找到它。 It won't automatically search your entire hard drive to find an application of that name. 它不会自动搜索整个硬盘驱动器以查找该名称的应用程序。 That would be a security risk, or at the least slow and ambiguous if you have more than one app with the same name. 如果您有多个具有相同名称的应用程序,那将是一个安全风险,或者至少是缓慢和模糊的。

If you enter the entire path to your application, like I've suggested above, then your OS knows exactly where to find the application and will run it directly without searching through the directories in your PATH. 如果您输入应用程序的完整路径,就像我上面建议的那样,那么您的操作系统确切地知道在哪里找到应用程序并直接运行它而无需搜索PATH中的目录。

You can add new directories to your PATH and you can add an alias to an application to one of the PATH directories. 您可以向PATH添加新目录,并可以将应用程序的别名添加到其中一个PATH目录中。 Then you would be able to just type "pear" and the OS could find it. 然后你就可以输入“pear”,操作系统就可以找到它。 There are tutorials for adding directories to your PATH all over the internet. 有一些教程可以在整个互联网上为你的PATH添加目录。

The locate database needs to be created in order to use the locate command. 需要创建locate数据库才能使用locate命令。 This is a separate issue. 这是一个单独的问题。 You can build the locate database and it will look over all of your files. 您可以构建locate数据库,它将查看您的所有文件。 It will take a little while to run, but when it's done the locate command will work. 运行需要一段时间,但完成后,locate命令将起作用。 However, since you already know where your pear app is, locate won't give you any new information. 但是,由于您已经知道梨应用程序的位置,因此找不到任何新信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM