更新Mac OS 10.7的grep [英] Updating grep for Mac OS 10.7

查看:123
本文介绍了更新Mac OS 10.7的grep的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将我的Mac上的grep更新到比Mac OS 10.7.2附带的2.5.1更新的版本。我的问题是:为Mac更新grep(或任何类似程序)的最佳方式是什么?我可以使用Fink或MacPorts来安装一个新版本并设置我的路径变量以查找文件树的适当分支,或者我可以更新usr / bin中的grep程序,或者可能还有另一种我没有考虑过的方法。因为我对Mac的命令行和Unix后端程序相对比较陌生,所以我担心打破某些东西。也就是说,我肯定愿意从源代码编译最新的grep发行版,并将其安装在/ usr / bin中,如果这是合适的方法的话。如果有人想知道为什么我想从2.5.1更新grep,我有两个原因:第一,我正在学习使用基于2.5.3的参考书(可能类似,我知道)使用grep;第二,更重要的是,我想学习如何更新这些程序,仅仅是为了有效地管理我自己的系统。



请随时指引我参考适当的参考而不是(或除了)为如何完成相关任务提供指导。



在此先感谢您,
Gregory

$ b $正如你所说,你可以使用Fink,MacPorts等......

但如果您只需要更新grep,您可能需要获取源代码并进行编译。



如果您决定使用此选项,请不要安装它在/ usr / bin 。



如果你这样做,你会覆盖你的操作系统所需要的东西。

所以另一个版本,你可能会遇到问题,因为操作系统会除了另一个版本。



另外,如果你这样做,你在更新操作系统时会遇到问题,如它可能会覆盖你自己的版本。



所以如果你想编译它,把它放在 / usr / local / bin 中(通常使用 - 前缀选项),并更新你的路径环境变量。
这是安全的方式。通常,编译这样的程序只是标准的 ./configure make sudo make install 的东西。 />
但是一定要先看看编译选项,方法是输入:

  ./ configure  - -help 


I would like to update grep on my Mac to a more recent version than 2.5.1, which came with Mac OS 10.7.2. My question is: what is the best way to update grep (or any similar program) for the Mac? I could use Fink or MacPorts to install a new version and set my path variable to look in the appropriate branch of the file tree, or I could update the grep program in usr/bin, or perhaps there's another approach that I haven't considered. Because I am relatively new to the command line and the Unix back-end of the Mac, I'm concerned about breaking something. That said, I'd certainly be willing to compile the most recent stable release of grep from source and install it in /usr/bin if that's the appropriate method. In case anyone wonders why I'd want to update grep from 2.5.1, I have two reasons: 1st, I'm learning to use grep with a reference book that is based on 2.5.3 (probably similar, I know); 2nd and more importantly, I want to learn how to update such programs simply as a matter of administrating my own system effectively.

Please feel free to direct me to an appropriate reference instead of (or in addition to) providing directions for how to accomplish the task in question.

Thanks in advance, Gregory

解决方案

As you said, you may use Fink, MacPorts, etc...

But if you just want to update grep, you may want to grab the sources, and compile them.

If you decide to go with this option, don't install it in /usr/bin.

If you do so, you will overwrite something needed by your OS.
So with another version, you may encounter problems, as the OS will except another version.

And also, if you do so, you'll have problems when updating your OS, as it might overwrite your own version.

So if you want to compile it, place it in /usr/local/bin (usually with the --prefix option), and update your path environment variable.
This is the safe way.

Usually, compiling such a program is just the standard ./configure, make and sudo make install stuff.
But be sure to take a look at the compiling options first, by typing:

./configure --help

这篇关于更新Mac OS 10.7的grep的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆