KokongW
V2EX  ›  macOS

Homebrew install mtr 问题

  •  
  •   KokongW · May 3, 2014 · 4942 views
    This topic created in 4393 days ago, the information mentioned may be changed or developed.
    遇到了一个错误,由于自己也不是很懂,发上来问问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
    15 replies    2015-03-29 00:58:57 +08:00
    jakwings
        1
    jakwings  
       May 3, 2014
    这不是错误,只是善意的提示。第一条提示是说苹果开发者官网提供了一个命令行工具包(包含 llvm 啥的)。可以不管它。

    第二次提示:要运行 mtr 需要 root 权限,假如你不想每次都用 sudo 输入密码再运行,可以执行它提供的那两条命令来为那个程序添加 set_uid 属性,在运行时临时借用 root 的权限而无需输入密码。
    KokongW
        2
    KokongW  
    OP
       May 3, 2014
    @jakwings 但似乎的确是安装失败了:
    mtr: command not found
    blacktulip
        3
    blacktulip  
       May 3, 2014
    @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
        4
    blacktulip  
       May 3, 2014
    或者你用 sudo /usr/local/Cellar/mtr/0.85/sbin/mtr 试试,还是不行就是路径没设好
    jakwings
        5
    jakwings  
       May 3, 2014
    @KokongW hash -r 刷新一下程序位置绑定信息?
    chen7897499
        6
    chen7897499  
       May 3, 2014
    输入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
        7
    KokongW  
    OP
       May 3, 2014
    @chen7897499 -bash: mtr: command not found

    还是一样呢。
    KokongW
        8
    KokongW  
    OP
       May 3, 2014
    @blacktulip 还是不行
    KokongW
        9
    KokongW  
    OP
       May 3, 2014
    @jakwings 还是依旧
    jakwings
        10
    jakwings  
       May 3, 2014
    @KokongW 将下面这句添加到 ~/.bashrc 的最后,然后重新运行 bash 。
    PATH="/usr/local/Cellar/mtr/0.85/sbin:$PATH"
    nodejx
        11
    nodejx  
       May 3, 2014
    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
        12
    KokongW  
    OP
       May 3, 2014
    @jakwings vim ~/.bashrc 看到里面是空白的,需要新建文件。路径在那儿?

    重新运行bash怎么做?

    小弟不太懂,烦请指点。
    jakwings
        13
    jakwings  
       May 3, 2014   ❤️ 1
    @KokongW 好吧,我只解释最后一次了,然后你得自己去查 Unix/Linux 系统的入门资料了。要完全解释很花时间。

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

    ~ 是 $HOME 的简写,bash 会自动扩展成 $HOME 的内容。echo $HOME 就可以知道是哪个文件夹了,就是用户文件夹的根目录。
    runcelim
        14
    runcelim  
       May 4, 2014
    sudo ln -s /usr/local/Cellar/mtr/0.85/sbin/mtr /usr/local/bin
    meteor
        15
    meteor  
       Mar 29, 2015
    echo 'export PATH="/usr/local/sbin:$PATH"' >> ~/.bash_profile
    我是看到brew doctor报这个waring, 加上就好了.
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   945 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 38ms · UTC 21:12 · PVG 05:12 · LAX 14:12 · JFK 17:12
    ♥ Do have faith in what you're doing.