You will need to download and install Xcode from either developers.apple.com or via the Appstore.
Downloading from the Apple website
requires you to register a Developer's account. You can
now log in with your AppleID.
You will also need to download and install the Command Line Developer Tools from Apple.
Please note that in order to install and run MacPorts on Mac OS X, your system must have installations of the following components:
- Apple's Xcode Developer Tools (version 4.4 or later for Mountain Lion, 4.1 or later for Lion, 3.2 or later for Snow Leopard, or 3.1 or later for Leopard), found at the Apple Developer Connection site, on your Mac OS X installation CDs/DVD, or in the Mac App Store. Using the latest available version that will run on your OS is highly recommended.
- Apple's Command Line Developer Tools are found at the Apple Developer Connection site, or they can be installed from within Xcode 4. Users of Xcode 3 or earlier can install this by ensuring that the appropriate option(s) are selected at the time of Xcode's install ("UNIX Development", "System Tools", "Command Line Tools", or "Command Line Support").
- Xcode 4 and later users need to first accept the Xcode EULA by either launching Xcode or running:xcodebuild -license
Once installed, head over to the available downloads of Macports, and select newest package available for your system ending with '.pkg'. As of now, the latest available download for my system has the filename MacPorts-2.1.3-10.8-MountainLion.pkg. Double click the installer package via Finder after downloading.
When completed, open the Terminal.app located in the /Applications/Utilities folder, and type:
Let's double check that the Xcode gcc package is your default compiler:
Your output will be different than mine but should follow the same format. If nothing is returned or you receive an error, Xcode is not configured correctly and you should follow step #2 of the quoteblock from the above Macports.org installation page.
macbookpro:~ alex$ port select --list gcc
Available versions for gcc:
Xcode's gcc should be sufficient to be used to build OpenWRT, but in practice users have run into problems. Next, compile Macports' gcc and set it as your default compiler:
And wait. You won't be doing much for quite some time. I'm only choosing the gcc44 package because it gets the job done, there is nothing inherent about this version and newer releases should work just fine.
UPDATE: Macports has precompiled gcc binaries. There is no wait. gcc44 and gcc47 have been tested and I can confirm that they both work.
As meurig points out here that on his system he gets a compilation error later on in his install which can be fixed with setting the following environment variables:
NOTE: You will have to enter the above lines if you close your Terminal session and want to begin again. You can add the lines to the end of ~/.bashrc for the variables to be set for new sessions.
Continuing on with the the standard installation:
Continue on to build OpenWRT on your Mac...
sudo port install coreutilse2fsprogs ossp-uuid
asciidoc binutils bzip2 fastjar flex getopt gtk2 intltool jikes \ zlib openssl p5-extutils-makemaker python26 rsync ruby sdcc unzip gettext libxslt bison gawk autoconf wget \ gmake ncurses findutils