mtr says "mtr: unable to get raw sockets"

This is because mtr needs to open raw sockets, which it can only do as root:

 $ mtr 8.8.8.8
    mtr: unable to get raw sockets.
    
 $ sudo mtr 8.8.8.8
    Keys:  Help   Display mode   Restart statistics   Order of fields   quit
                                               Packets               Pings
 Host                               Loss%   Snt   Last   Avg  Best  Wrst  StDev
 1. 216.239.48.53                    0.0%    69   24.9   32.0  24.8  88.8    12.5
    64.233.174.55
    209.85.246.205
 2. ???
 3. google-public-dns-a.google.com   0.0%    69   24.9  26.5  24.9  35.9   1.6
 

This can be avoided by changing the ownership of mtr to root and activating the suid 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

You are probably reading this because you overlooked the "Caveats" in the install messages:

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.
Christoph Beck About 10 years ago