Please MERGE this page and macosx.lion into this page: buildroot.exigence.macosx. Also consult the OpenWrt Forum: Build OpenWrt on Mac OS X 10.7 Lion
This guide will show you how to build an OpenWrt firmware on MacOSX. It was tested on Mountain Lion 10.8.3; however, it should be easily portable on other versions as well.
There are multiple challenges in building OpenWrt on MacOSX.
There are multiple ways to fix this, but for the sake of this wiki we will show how to do that using a disk image (to avoid repartitioning the hard drive) and MacPorts.
All the commands below have to be run in a terminal. You can use either the terminal available in MacOSX by default (available in “Application” –> “Utilities” –> “Terminal”) or a third party terminal. I would personally recommend the following third party terminal (called iTerm2), that provides features most Gnome users are probably used to and that the MacOSX default terminal is lacking: http://www.iterm2.com/#/section/home. At the end of the installation, this terminal will be available in “Application” –> “Utilities” –> “iTerm”.
Ok, so let's start by creating a disk image where we will perform all our OpenWrt development. For that, we will use the native MacOSX command “hdiutil” to create a new disk image and attach it to the system.
hdiutil create -size 20g -fs "Case-sensitive HFS+" -volname OpenWrt OpenWrt.dmg hdiutil attach OpenWrt.dmg
These commands will create a 20GB image in your current directory, and attach it with the volume name “OpenWrt”. After executing them, you should see a new “OpenWrt” volume available in the left pane of your “Finder”. It should be empty.
Let's move into this new image so we're prepared for the next steps:
Next step will be to install all the packages necessary to build an OpenWrt firmware on your system. We can see two types of packages here:
Xcode installation is pretty straightforward:
Blah-MacBook:OpenWrt Blah$ xcode-select --install
The MacPorts packages are available on their official download website:
Here, select the latest MacPorts release available for your system and download the corresponding *.pkg file.
After download, go to your finder, and execute the file. Follow the on-screen procedure until completion.
Once you're done, go back to your terminal and let's use it in order to install the packages required to build an OpenWrt firmware. If MacPorts have been correctly installed, the “port” command should now be available.
First, update to the latest MacPorts Portfiles:
Blah-MacBook:OpenWrt Blah$ sudo port selfupdate
Then install the packages:
Blah-MacBook:OpenWrt Blah$ sudo port install coreutils e2fsprogs ossp-uuid asciidoc binutils \ bzip2 fastjar flex getopt gtk2 intltool jikes hs-zlib openssl p5-extutils-makemaker python27 \ subversion rsync ruby sdcc unzip gettext libxslt bison gawk autoconf wget gmake ncurses findutils \ grep gnutar
Congratulation! You're all set :)