Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to get the source code of a small command line tool using objdump on Mac OS X.

I've used arm-linux-objdump on Linux and find it a great tool.

Is there any way to install objdump on OS X? I've searched Google and found information about arm-apple-dawin9-objdump, but failed to find anything to download.

share|improve this question

objdump is part of binutils.

share|improve this answer
7  
Homebrew has it too! :) – Adrian Petrescu Dec 7 '11 at 2:26
6  
I was hoping homebrew has it! Thanks! brew install binutils – nacho4d Sep 9 '13 at 8:37
9  
MacPorts binutils installs objdump as gobjdump. – user267739 Oct 29 '13 at 6:54
    
-bash: objdump: command not found – Igor G. May 11 at 21:58

If you have XCode Tools installed on your Mac, you can use the otool that comes with it. I believe it does pretty much what objdump is capable of.

share|improve this answer
6  
+1 for otool - use otool -tV <executable> to disassemble – Paul R Nov 3 '10 at 8:54
1  
dwarftool also offers some similar functionality. – Mike Weller Oct 19 '12 at 7:30
2  
does otool have an option like objdump -S, which gives assembly output annotated with source code? Couldn't really figure out from the --help output. – rgngl Mar 13 '13 at 13:17
    
-bash: dwarftool: command not found – Igor G. May 11 at 21:59

If your file is 64bits, you should use otool instead of gobjdump in binutils. On Mac OSX, gobjdump is for 32bits.

share|improve this answer

You can install it with Homebrew:

$ brew install binutils
==> Downloading https://homebrew.bintray.com/bottles/binutils-2.25.yosemite.bottle.tar.gz
######################################################################## 100.0%
==> Pouring binutils-2.25.yosemite.bottle.tar.gz
🍺  /usr/local/Cellar/binutils/2.25: 107 files, 140M
$ which gobjdump
/usr/local/bin/gobjdump
share|improve this answer

You must log in to answer this question.

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