nm -s broken in Xcode 7.3

I received an e-mail from someone – a couple already – who told me that some of my scripts are broken. Specifically scripts like debugMachKernel.sh that use nm. It appears that Xcode 7.3 (7D175) no longer supports the -s argument. Or not like it did before:

nm -x -Ps __TEXT __text -arch x86_64 /System/Library/Kernels/kernel

Right. That no longer works, and dumps this error message:

../nm: for the -s option: bad number of arguments (must be two arguments).

Removing the -s __TEXT __text part works:

nm -Px -arch x86_64 /System/Library/Kernels/kernel

And running it like that will only take a few milliseconds longer. Anyway. For the few that ran into this, and were too lazy to report the error… now you know how to work around this bug.

Update: I worked around this problem by moving the -s __TEXT __text arguments to after the filename.

nm -Px -arch x86_64 /System/Library/Kernels/kernel -s __TEXT __text

One thought on “nm -s broken in Xcode 7.3

  1. Thank you, I thought I was going mad! The annoying part is that the usage clearly states the s flag should come *before* the filename. It also appears without the preceding dash. But your trick works, so all is good🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s