Using MTR on OS X without sudo

MTR is awesome, but in a recent update to the package in brew means that you need to sudo to use it. This is particularly a pain when you don’t run as an account that is able to sudo.

In addition, a lot of the functionality of MTR has been moved out into the mtr-packet binary, which makes a lot of the instructions out there on how to resolve this annoyance now wrong.

A quick and dirty fix to get around this is to set the SUID bit, and change ownership to root. You also need both mtr and mtr-packet in your path.

sudo chmod 4755 /usr/local/Cellar/mtr/0.93_1/sbin/mtr-packet 
sudo chown root /usr/local/Cellar/mtr/0.93_1/sbin/mtr-packet 

ln -s /usr/local/Cellar/mtr/0.93_1/sbin/mtr /usr/local/bin/mtr 
ln -s /usr/local/Cellar/mtr/0.93_1/sbin/mtr-packet /usr/local/bin/mtr-packet

Leave a Reply

Your email address will not be published. Required fields are marked *