Friday, May 29, 2015

Install binutils in Mac OS

Sometimes we need to install binutils in Mac OS to do something. Please refer the sites.

Building a GCC 4.9 cross compiler on OS X Mavericks

I use the below steps to build binutils in OS X Yosemite.

1) Install brew.

ruby -e "$(curl -fsSL"

2) Installing GCC.

We need GCC to compile binutils in Mac OS

brew tap homebrew/versions
brew install --enable-cxx gcc49

3) Download binutils.

Download the source code of binutils. We get binutils-2.25.tar.gz.

4) Extract binutils.

Extract the source code to the home directory. For example,


5) Set environment variables.

We can set environment variables to build binutils.

export PREFIX="$HOME/opt/cross"
export TARGET=i686-elf
export PATH="$PREFIX/bin:$PATH"

6) Build binutils

In the ~/src/binutils-2.25 directory run the below command.

../binutils-2.24/configure --target=$TARGET --prefix="$PREFIX" --disable-nls --disable-werror

make install

8) Check if binutils is installed.

cd ~/opt
find . -name *objdump*

The results display.



No comments:

Post a Comment