I'm attempting to determine the path MTU from my Mac to various sites, and can't find a built-in utility to accomplish this.

In Linux, I would use a utility like tracepath, but I"m wondering if there is some sort of equivalent available for OS X.

3 Answers 3


You can use the standard ping that the Mac OSX comes with to find pmtu.

ping -D -s <size> <host> shoud do the trick. Please note, the size is just the ICMP datagram payload size. To see the IP MTU, you need to add 8 bytes of the ICMP header and 20 bytes of the IP header (so for example, to send 1500 Bytes long IP packet, you need to specify size as 1472). Please note, -D is important here, as it sets the Dont-Fragment flag on.

You can also use ping -D -g <minsize> -G <maxsize> -h <sizeincr> <host> to run a ping sweep. This pings your host with packets starting from minsize up to maxsize in sizeincr increments. Again, same rule applies to your sizes - these are just for ICMP payload (so you need to add 28 Bytes to the size specified here for the full IP MTU size).

What you're looking for is an ICMP unreachable message back with a "Fragmentation needed but Don't Fragment flag on" sub-type back. The IP address of the sender of the above ICMP message is the host or router which has its MTU set to lower than the size of your packet, on the link which it would use to forward your packet further towards the destination.

Please note as well, that sometimes (badly misconfigured) firewalls or traffic filters will block all ICMP messages and in such case, you'll just see no response. To test which host dropped the packet, you could run traceroute to your destination and then repeatedly ping every hop on the way with '-D' and a size or a sweep to discover the local MTU of the link that hop is connected to. It will be the link between the last host you can ping and the first host you can't that will have a smaller MTU.

Again - this is all subject to routers handling ICMP, which they might not.

The PMTUD (Path MTU Discovery) protocol works in the same fashion. It uses TCP packets with DF flag on. The TCP sessions endpoints agree on their MSS (Maximum Segment Size, which is MTU less IP and TCP headers, 40B) - they choose the smaller of the MSS values advertised by each host in the TCP handshake. Then they send all traffic with DF flags on, and wait for the ICMP unreachable or a TCP ACK. The latter means the PMTU is sufficient, the former mean they need to drop MSS.

Hope that helps!

  • Definitely what I was looking for! Too bad the linux version of ping doesn't have the same switches to use, as I'm finding this is more exact than using tracepath on linux.
    – reedog117
    Mar 21, 2014 at 14:18
  • actually, you can do the same on Linux (except for sweep). You can use ping -M do -s <size> <host> - the -M flag is a hint for PMTUD (-M do means prohibit fragmentation even locally, -M want means run path MTU discovery, but allow fragmentation when local, and -M dont means don't do pmtud and allow fragmentation).
    – mike
    Mar 22, 2014 at 14:57

traceroute is available on the Mac. Traceroute is actually a more featured version of tracepath.

man traceroute will give you the details but traceroute <host> does the same thing as tracepath <host>.

  • 1
    I'm interested in finding out the path MTU for a connection, not the ms delay caused by each hop. I don't see how tracepath and traceroute are the same thing.
    – reedog117
    Mar 21, 2014 at 2:21
  • 9
    It's not the same thing, and traceroute doesn't determine the MTU. This answer is incorrect in assuming that. Use ping -g 1444 -G 1508 -c 2 -h 1 -D example.com
    – l'L'l
    Mar 21, 2014 at 12:38
  • Actually I don't seem to have a traceroute on my Mac (Mojave 10.14.3). Should I? FWIW there's a tcptraceroute on brew.
    – PapaFreud
    Jun 4, 2019 at 8:14
  • traceroute is no longer installed by default on the Mac. The ping -D method is now the best one. May 13, 2020 at 21:51
  • Looks like Mac's traceroute doesn't support the --mtu parameter either.
    – tschumann
    Jul 1, 2020 at 5:24

doing a ping -DRo <hostname| IPAddr> did a simple tracepath for me

I also created a simple shellscript called tracepath, and looks like:

#ping -D -g <minsize> -G <maxsize> -h <sizeincr>
echo "tracepath to $1 \n"
ping -DRo $1

Not quite as nice as a real tracepath

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .