Homebrew install mtr 问题

2014-05-03 16:33:23 +08:00
 KokongW
遇到了一个错误,由于自己也不是很懂,发上来问问V友们!

$ brew install mtr
Warning: A newer Command Line Tools release is available
The standalone package can be obtained from
https://developer.apple.com/downloads/,
or it can be installed via Xcode's preferences.
==> Downloading ftp://ftp.bitwizard.nl/mtr/mtr-0.85.tar.gz
Already downloaded: /Library/Caches/Homebrew/mtr-0.85.tar.gz
==> Downloading https://github.com/traviscross/mtr/commit/edd425.diff
Already downloaded: /Library/Caches/Homebrew/mtr--patch-c1ed669cdf65d607f75abc729a333b180ee42343.diff
==> Patching
patching file asn.c
patching file curses.c
patching file display.c
patching file dns.c
patching file getopt.c
patching file getopt1.c
patching file gtk.c
patching file mtr.c
patching file net.c
patching file raw.c
patching file report.c
patching file select.c
patching file split.c
==> ./configure --prefix=/usr/local/Cellar/mtr/0.85 --without-gtk --without-glib
==> make install
==> Caveats
mtr requires superuser privileges. You can either run the program
via `sudo`, or change its ownership to root and set the setuid bit:

sudo chown root:wheel /usr/local/Cellar/mtr/0.85/sbin/mtr
sudo chmod u+s /usr/local/Cellar/mtr/0.85/sbin/mtr

In any case, you should be certain that you trust the software you
are executing with elevated privileges.
==> Summary
🍺 /usr/local/Cellar/mtr/0.85: 8 files, 160K, built in 22 seconds
4396 次点击
所在节点    macOS
15 条回复
jakwings
2014-05-03 16:50:57 +08:00
这不是错误,只是善意的提示。第一条提示是说苹果开发者官网提供了一个命令行工具包(包含 llvm 啥的)。可以不管它。

第二次提示:要运行 mtr 需要 root 权限,假如你不想每次都用 sudo 输入密码再运行,可以执行它提供的那两条命令来为那个程序添加 set_uid 属性,在运行时临时借用 root 的权限而无需输入密码。
KokongW
2014-05-03 19:23:28 +08:00
@jakwings 但似乎的确是安装失败了:
mtr: command not found
blacktulip
2014-05-03 19:25:48 +08:00
@KokongW

看提示
mtr requires superuser privileges. You can either run the program
via `sudo`, or change its ownership to root and set the setuid bit:

你自己不是贴了嘛

用 sudo
blacktulip
2014-05-03 19:27:00 +08:00
或者你用 sudo /usr/local/Cellar/mtr/0.85/sbin/mtr 试试,还是不行就是路径没设好
jakwings
2014-05-03 20:18:00 +08:00
@KokongW hash -r 刷新一下程序位置绑定信息?
chen7897499
2014-05-03 20:21:44 +08:00
输入brew doctor
然后加权限sudo chown root:wheel /usr/local/Cellar/mtr/0.85/sbin/mtr
sudo chmod u+s /usr/local/Cellar/mtr/0.85/sbin/mtr
然后再mtr
KokongW
2014-05-03 20:32:54 +08:00
@chen7897499 -bash: mtr: command not found

还是一样呢。
KokongW
2014-05-03 20:33:43 +08:00
@blacktulip 还是不行
KokongW
2014-05-03 20:34:01 +08:00
@jakwings 还是依旧
jakwings
2014-05-03 21:07:40 +08:00
@KokongW 将下面这句添加到 ~/.bashrc 的最后,然后重新运行 bash 。
PATH="/usr/local/Cellar/mtr/0.85/sbin:$PATH"
nodejx
2014-05-03 21:07:43 +08:00
ls -al `which mtr`
lrwxr-xr-x 1 teacher admin 35 Jan 17 21:28 /usr/local/bin/mtr -> /usr/local/Cellar/mtr/0.85/sbin/mtr
KokongW
2014-05-03 21:35:33 +08:00
@jakwings vim ~/.bashrc 看到里面是空白的,需要新建文件。路径在那儿?

重新运行bash怎么做?

小弟不太懂,烦请指点。
jakwings
2014-05-03 21:44:21 +08:00
@KokongW 好吧,我只解释最后一次了,然后你得自己去查 Unix/Linux 系统的入门资料了。要完全解释很花时间。

不修改 ~/.bashrc 了,直接 vim ~/.bash_profile ,在文件末尾添加 10 楼那句命令,保存。
然后不用重启 bash ,直接执行 source ~/.bash_profile ; hash -r

~ 是 $HOME 的简写,bash 会自动扩展成 $HOME 的内容。echo $HOME 就可以知道是哪个文件夹了,就是用户文件夹的根目录。
runcelim
2014-05-04 23:30:37 +08:00
sudo ln -s /usr/local/Cellar/mtr/0.85/sbin/mtr /usr/local/bin
meteor
2015-03-29 00:58:57 +08:00
echo 'export PATH="/usr/local/sbin:$PATH"' >> ~/.bash_profile
我是看到brew doctor报这个waring, 加上就好了.

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/110956

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX