This is an old revision of the document!
Build system setup macOS
This method is NOT OFFICIALLY supported. A native GNU/Linux environment is recommended.
Tested with macOS 10.15.7, Xcode 12.1 build 12A7403.
Tested with macOS 11.6, Xcode 13.0 build 13A233, arm64 kernel.
Obtain & install Xcode or CLT:
- If you prefer to not obtain Xcode, then one of the alternative is:
- obtain Command-Line-Tools1 (CLT). It is also known as Command Line Developer Tools. Note: installer download is under/near 300 MB, and needs around 2.5 GB space.
Unhide hidden files/folders in macOS:
- We need to view full filename, file extensions, all files & directories, etc including hidden ones, very accurately, so that there is lesser mistakes.
- Finder is very similar to
Windows-Explorerfile-browser app/tool: in macOS > start or click on theFinderapp > in left side/pane, selectApplications> then scroll down & go intoUtilitiessubfolder > then click onTerminalorTerminal.appto start it. macOS “Terminal” is very similar to WindowsCommand-Prompt, a command-line interface (CLI) tool. - Run below command inside
Terminal:defaults write com.apple.Finder AppleShowAllFiles true
- then you must reboot Mac-computer OR run (any one of the) below command:
/usr/bin/sudo /usr/bin/killall Finder /System/Library/CoreServices/Finder.app
or, run just this:
/usr/bin/sudo /usr/bin/killall Finder
or, just this:
sudo killall Finder
- then
Finderwill auto start, and all hidden files+folders will by-default begin to be shown to user in macOS Finder. - in macOS
Finderor inside any other file browsing window in macOS, user can also press below THREE buttons altogether ONCE to show all HIDDEN files/folders:[Command⌘] + [Shift⇧] + [.>]- if user press-es above three buttons again, file-browsing-window will HIDE the HIDDEN files/folders.
- By default in macOS,
Finderwill keep most of the file's extension hidden. But we need to see all file's extension, so we can be sure & not make mistake. To view all file's extension, do below steps:- in macOS > start “Finder” app > goto main menu >
Finder>Preferences>Advanced> select theShow All Filename Extensionsoption.
Install any one of the (3rd-party) package manager software in macOS:
- Homebrew : Note: it shares user's usage/private data with Ggl.
Prepare a dedicated case-sensitive filesystem for OpenWRT build/compile:
- 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 below command:
- if you have homebrew then run this:
brew install coreutils findutils gawk grep gnu-getopt gnu-tar wget diffutils git-extras quilt svn make ncurses pkg-config
- if you have MacPorts then run this:
sudo port install coreutils findutils gawk grep getopt gnutar wget diffutils git-extras quilt subversion gmake ncurses pkgconfig
Create a file called env.sh in /Volumes/OpenWrt
This is to allow the utilities (aka: packages) we just installed to be used instead of the macOS provided ones.
- For x86_64 Apple hardware, & when you have homebrew, then create
env.shfile with below content: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/libexec/gnubin:$PATH" PATH="/usr/local/opt/findutils/libexec/gnubin:$PATH" export PATH
- For x86_64 Apple hardware, & when you have MacPorts, then create
env.shfile with below content:PATH="/opt/local/libexec/gnubin:$PATH" PATH="/opt/local/libexec/coreutils:$PATH" PATH="/opt/local/bin/svn-tools:$PATH" PATH="/opt/local/bin:$PATH" PATH="/opt/local/sbin:$PATH" export PATH
For arm64 (Apple Silicon(M1)) Apple hardware:
PATH="/opt/homebrew/opt/make/libexec/gnubin:$PATH" PATH="/opt/homebrew/opt/gnu-getopt/bin:$PATH" PATH="/opt/homebrew/opt/gettext/bin:$PATH" PATH="/opt/homebrew/opt/coreutils/libexec/gnubin:$PATH" PATH="/opt/homebrew/opt/findutils/libexec/gnubin:$PATH" export PATH
Check homebrew official page or MacPorts-guide if you need more information related to PATH variable
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.
Golang related
For darwin/arm64 and linux/aarch64 golang package (feed “packages”) golang C-bootstrap method doesn't work, but it is possible to use external golang bootstrap. On MacOS arm64 the easiest way is to install golang using brew and use installed golang as bootstrap:
brew install golang
Then set CONFIG_GOLANG_EXTERNAL_BOOTSTRAP_ROOT=“/opt/homebrew/opt/go/libexec” in .config file