Build OpenWRT Toolchain on Mac OS X

A very quick guide to building the OpenWRT buildroot or toolchain on Mac OS X (10.10).

1. Install Xcode
Install Xcode from App Store (it is free).

2. Install pkgsrc
I have used fink, macports and homebrew, but now that I have tried pkgsrc I don’t think I will consider any of the others in a while. Install pkgsrc the standard way. Note: there is an x86_64 version for Mac OS X – it is probably what you want – just replace i386 with x86_64 in the download link.

Using pkgsrc, install these packages required by OpenWRT:

$ sudo pkgin install getopt coreutils gawk gtar findutils

3. Case sensitive filesystem
Your root filesystem on your Mac is probably case insensitive, and that is supposed to cause problems to building OpenWRT. Get yourself a USB disk or make a disk image an format it as case sensitive HFS+. If you do it from the command line you can avoid making it journaling:

$ diskutil eraseVolume hfsx OpenWRTdisk /dev/disk3s2

4. Building
This assumes you want the toolchain from that current stable build (14.07):

$ git clone git://git.openwrt.org/14.07/openwrt.git
$ cd openwrt
$ scripts/feeds update -a
$ scripts/feeds install -a
$ make menuconfig

In menuconfig I made just two changes: 1) setting my target platform, 2) asking toolchain to be built. Make all settings you want. I then ran:

$ make toolchain/install

You now find your toolchain is now in staging_dir 🙂
If you instead would have run just “make” the entire OpenWRT firmware would have been built.

  1. Dirk Thannhäuser

    I tried the same for OpenWrt 15.05:

    If you install this on an out of the Box OS X some further components are missing.

    Build dependency: Please install the openssl library (with development headers)
    Build dependency: Please install GNU ‘grep’
    Build dependency: Please install GNU ‘wget’

    Execute the following command:
    sudo pkgin install grep wget openssl

    this installs the missing packages

    It is also important that the default PATH has pkgsrc packages first and not last. (/opt/pkg/bin)

    /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/pkg/bin
    Works not, because if a program with the same name is found in the standard location it will be used instead of the pkg variant

    /opt/pkg/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
    This works the required gnu tools are found.

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Time limit is exhausted. Please reload CAPTCHA.

This site uses Akismet to reduce spam. Learn how your comment data is processed.