User Tools

Site Tools


docs:guide-developer:buildroot.exigence.macosx

OpenWrt Buildroot – Installation on macOS

If you test on other version of macOS / OS X or different release, add/edit below please!


These instructions worked on OS X 10.13.1 on 6 Nov 2017, and on OS X 10.12.3 on 15 Feb 2017, and on OS X 10.11.5 on 7 May 2016.

  1. Install Xcode or at least Xcode command line tools from the MacOSX App Store
  2. Install additional formulae:
    brew install coreutils diffutils findutils gawk gnu-getopt gnu-tar grep wget quilt xz

    diffutils is required to ensure quilt refreshes patches correctly.

  3. gnu-getopt is keg-only, so force linking it:
    brew ln gnu-getopt --force
  4. OS X by default comes with a case-insensitive filesystem. OpenWrt won't build on that. As a workaround, create a (Sparse) case-sensitive disk-image that you then mount in the finder and use as build directory:
    hdiutil create -size 20g -type SPARSE -fs "Case-sensitive HFS+" -volname OpenWrt OpenWrt.sparseimage
    hdiutil attach OpenWrt.sparseimage

    Another option if using an APFS formatted disc is to create a case-sensitive APFS volume.

  5. Change to /Volumes/OpenWrt
    cd /Volumes/OpenWrt

    (Your newly created and mounted disk image)

  6. Now proceed normally (git clone…)

Useful things to put in .bash_profile:

. /Applications/Xcode.app/Contents/Developer/usr/share/git-core/git-completion.bash
. /Applications/Xcode.app/Contents/Developer/usr/share/git-core/git-prompt.sh

export GIT_PS1_SHOWDIRTYSTATE=1
export GIT_PS1_SHOWSTASHSTATE=1
export GIT_PS1_SHOWCOLORHINTS=1
#export GIT_PS1_SHOWUNTRACKEDFILES=1
export GIT_PS1_SHOWUPSTREAM="auto"

# Watch the escapes for " in the following
export PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND;} __git_ps1 \"\[\033[0;33m\]\u@\h \[\033[1;34m\]\w\[\033[0m\]\" \"\[\033[1;34m\] \$\[\033[0m\] \""

These instructions worked on OS X 10.10.3, building trunk Rev. 45337 on 9.April.2015.

  1. Install Xcode or at least Xcode command line tools from the MacOSX App Store
  2. Add duplicates repository to homebrew for grep formulae:
    brew tap homebrew/dupes
  3. Install additional formulae:
    brew install coreutils findutils gawk gnu-getopt gnu-tar grep wget quilt xz
  4. gnu-getopt is keg-only, so force linking it:
    brew ln gnu-getopt --force
  5. To get rid of “date illegal option” you can add to your .bash_profile:
    PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"
  6. Now proceed normally (git clone…)

These instructions worked for me on OS X 10.10, building 14.07

  1. Install prerequisites:
    pkgin install getopt coreutils gawk gtar findutils
  2. Now proceed normally (git clone…)

These instructions worked for me on OS X 10.9.5, building 14.07 branch “Barrier Breaker”.

  1. Install prerequisites:
    brew install asciidoc binutils coreutils findutils gawk gettext gnu-getopt gnu-tar openssl xz
  2. BuildRoot expects 'getopt' to be GNU getopt, so symlink it into place:
    ln -s `brew --prefix gnu-getopt`/bin/getopt `brew --prefix`/bin/gnugetopt
  3. If you run into any additional steps required, please add them to this page!

These instructions worked for me on OS X 10.13.6, High Sierra, openwrt 18.06.0

  1. Makefile will bomb unless you rename gxargs to xargs.
    ln -s /usr/local/bin/gxargs /usr/local/bin/xargs
  2. Create an APFS volume with case-sensitivity enabled
  3. Add “brew install gnutime”
  4. 18.06.0 Use non-dev build. Dev build seems to be broken at this time. Use 18.06.0 branch in git

For OS X 10.15 aka Catalina add the following variable to your environment, else toolchain build will fail at kernel-headers

MACOSX_DEPLOYMENT_TARGET=10.14 (with Xcode 11.3 + this is no longer required)

Some packages/dependencies (eg. glib2) require internationalisation tools such as gettext. By default brew installs this as 'keg only' so will require adding to the path to be discovered: echo 'export PATH=“/usr/local/opt/gettext/bin:$PATH”' » ~/.zshrc


OpenWrt on MacOS - Catalina 10.15.3 2020/03/02

Install xcode (v11.3.1 (11C504)) Install Homebrew

Install the following brew packages (items in brackets are auto-installed dependencies as at time of writing) items after the ‘-‘ describe which OpenWrt dependencies the package satisfies.

grep (pcre) - grep gawk (gmp, mpfr, readline) - awk gnu-tar - tar gnu-getopt - long getopts coreutils - fileutils/filestat findutils - gfind & gxargs wget (gettext, libunistring, libidn2, openssl@1.1) - wget

optional but recommended if you’re going to work with patches/patchwork/pull requests:

diffutils - diff git-extras - git-pw, git-pr quilt (gnu-sed) - quilt

As a one-liner:

brew install coreutils findutils gawk grep gnu-getopt gnu-tar wget diffutils git-extras quilt

Some of the Homebrew packages are what is known as ‘Keg only’, in other words the commands they provided are NOT linked into /usr/local/bin because they can potentially conflict with the MacOS provided versions. Homebrew no longer supports force linking them either (e.g. brew ln gnu-getopt –force). Whilst it is possible to solve that issue by including the relevant command directory in the PATH, a neater solution is to manually link the 2 commands required into /usr/local/bin.

The diff from diffutils is newer than that provided by MacOS and subtly changes the way that quilt patch refreshes work. Without it a lot of unnecessary patch churn is generated.

gnu-getopt requires specific linking into /usr/local/bin - linking as gnugetopt avoids conflicting with system getopt and is still found by the build system: (cd /usr/local/bin ; ln -s ../opt/gnu-getopt/bin/getopt gnugetopt)

Similarly some OpenWrt packages in the packages feed (e.g. glib2) require msgfmt from gettext (cd /usr/local/bin ; ln -s ../opt/gettext/bin/msgfmt msgfmt)

Ensure /usr/local/bin is in your PATH.


OpenWrt on MacOS - Catalina 10.15.3 2020/03/02

* Install xcode (tested with Xcode 11.5 build 11E608c) * Install Homebrew

Install the following brew packages (items in brackets are auto-installed dependencies as at time of writing) items after the ‘-‘ describe which OpenWrt dependencies the package satisfies.

grep (pcre) - grep gawk (gmp, mpfr, readline) - awk gnu-tar - tar gnu-getopt - long getopts coreutils - fileutils/filestat findutils - gfind & gxargs wget (gettext, libunistring, libidn2, openssl@1.1) - wget

optional but recommended if you’re going to work with patches/patchwork/pull requests:

diffutils - diff git-extras - git-pw, git-pr quilt (gnu-sed) - quilt

As a one-liner:

brew install coreutils findutils gawk grep gnu-getopt gnu-tar wget diffutils git-extras quilt

Some of the Homebrew packages are what is known as ‘Keg only’, in other words the commands they provided are NOT linked into /usr/local/bin because they can potentially conflict with the MacOS provided versions. Homebrew no longer supports force linking them either (e.g. brew ln gnu-getopt –force). Whilst it is possible to solve that issue by including the relevant command directory in the PATH, a neater solution is to manually link the 2 commands required into /usr/local/bin.

The diff from diffutils is newer than that provided by MacOS and subtly changes the way that quilt patch refreshes work. Without it a lot of unnecessary patch churn is generated.

gnu-getopt requires specific linking into /usr/local/bin - linking as gnugetopt avoids conflicting with system getopt and is still found by the build system: (cd /usr/local/bin ; ln -s ../opt/gnu-getopt/bin/getopt gnugetopt)

Similarly some OpenWrt packages in the packages feed (e.g. glib2) require msgfmt from gettext (cd /usr/local/bin ; ln -s ../opt/gettext/bin/msgfmt msgfmt)

Ensure /usr/local/bin is in your PATH.

OpenWrt on MacOS - Catalina 10.15.5 (2020-07-03)

Environment

Tested with Xcode 11.5 build 11E608c

Setup

Install brew and Xcode

We will be using a sparsebundle to allow us to have a case sensitive filesystem.

The size that you provide will be the max size of the volume for working with OpenWrt

hdiutil create -size 20g -type SPARSE -fs "Case-sensitive HFS+" -volname OpenWrt OpenWrt.sparseimage
hdiutil attach OpenWrt.sparseimage

Change to the OpenWrt volume and create the necessary directories

cd /Volumes/OpenWrt

Install the necessary packages with brew

brew install coreutils findutils gawk grep gnu-getopt gnu-tar wget diffutils git-extras quilt make

Create a file called env.sh in /Volumes/OpenWrt This is to allow the utilities we just installed to be used instead of the macOS provided ones.

PATH="/usr/local/opt/make/libexec/gnubin:$PATH"
PATH="/usr/local/opt/gnu-getopt/bin:$PATH"
PATH="/usr/local/opt/gettext/bin:$PATH"
PATH="/usr/local/opt/coreutils/bin:$PATH"
PATH="/usr/local/opt/findutils/libexec/gnubin:$PATH"
export PATH

When developing do source /Volumes/OpenWrt/env.sh to set up the path variable. This leaves your system in a clean state without symlinking.

Now proceed normally.

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
docs/guide-developer/buildroot.exigence.macosx.txt · Last modified: 2020/07/03 19:23 by scj643