How can I install objdump on Mac OS X?

59,835

Solution 1

objdump is part of binutils.

Solution 2

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

Solution 3

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

Solution 4

You should use otool because objdump is a binutils tool for the ELF binary format on Linux and most other UNIX systems. otool is the the disassembler for MacOS's Mach-O binary format. Type $ man otool for instructions on use.

Share:
59,835

Related videos on Youtube

Chilly Zhong
Author by

Chilly Zhong

Updated on September 17, 2022

Comments

  • Chilly Zhong
    Chilly Zhong almost 2 years

    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.

  • user1699603
    user1699603 over 12 years
    Homebrew has it too! :)
  • Rakesh Senwar
    Rakesh Senwar almost 11 years
    I was hoping homebrew has it! Thanks! brew install binutils
  • windsor
    windsor over 10 years
    MacPorts binutils installs objdump as gobjdump.
  • IgorGanapolsky
    IgorGanapolsky about 8 years
    -bash: objdump: command not found
  • Joseph Sheedy
    Joseph Sheedy about 7 years
    brew install binutils also installs it as gobjdump
  • hmijail mourns resignees
    hmijail mourns resignees about 7 years
    As of 2017, gobjdump 2.27 (I think I got it from homebrew?) does work well with 64 bits in macOS Sierra (10.12)