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 (Darwin v19.6.0), Xcode 12.1 build 12A7403, & packages from homebrew.
Tested with macOS 11.6 (Darwin v20.6.0) Xcode 13.0 build 13A233, arm64 kernel, & packages from homebrew.

● to view macOS version numbers, etc, run : sw_vers
● to view Darwin version numbers, etc, run : sysctl kern.osrelease

macOS & Darwin Unix:

You can skip this section (if you want to), & goto next section A. Obtain build toolchain.
Brief/short info on macOS and Darwin Unix : macOS contains APSL (Apple Public Source License) & BSD (Berkeley Software Distribution) and others licensed opensource1, 2, 3 Darwin Unix based XNU1 hybrid core/kernel, & also contains Darwin unix as internal subsystem to support commandline based tools (from various Unix & Linux distros). Darwin supports POSIX API because of its BSD unix based lineage and because of largely FreeBSD userland tools, etc. Most drivers, & GUI layer's most components are proprietary (not-opensource) licensed. Build tools need to be compatible with “darwin”.

  • In macOS v10.15.x (Catalina) & earlier versions, the Kernel modules, hardware drivers, etc are known-as & usually loaded as kext (kernel extension) inside kernel space/layer, & uses LKM with KPI (kernel programming interface) & d-KPI1 (deprecated-KPI). But, since macOS v11 (Big Sur) & newer versions, the newer sext/sysext (system extension) and (older) kext without d-KPI are used in user space/layer. And newer dext (driver extension) in macOS v11 & later also runs in user space/layout, and replaces earlier I/O kit. So hardware/software developer/MFR should still supply sext/dext & kext (without d-KPI). Earlier macOS/darwin used HFS partition, now uses APFS.
  • A derivative, OpenDarwin project released last stable v7.2.1 on July 16, 2004, then shutdown on July 25, 2006. Some free software community, ISC, etc particiapted with Apple to develop OpenDarwin1, and some ideas were used to build GNU-Darwin1, 2. Another derivative, PureDarwin1 released a preview based Darwin 9 with X11 GUI in 2015, followed by a command-line only 17.4 Beta based on Darwin 17 in 2019.
  • Drivers: Wireless: 1, 2. NIC: 1, 2, 3. Zyxel modem: 1. Card-readers: 1. Ext2 & Ext3 (Linux filesystem support) under macOS: 1, 2.


A. Obtain build toolchain:

Obtain build toolchain that is more suitable for Apple hardware & macOS & Darwin Unix.

● Install Xcode or CLT:

  1. Obtain Xcode1 from here. Note: installer file download is over/near 5 GB, and needs 17+ GB space. Xcode 11.5 : 16,958,217,326 bytes (10.5 GB on disk).
    • to view installed Xcode version number, run this command : xcodebuild -version . If output not-showing version number then Xcode is not-installed.
  2. If you prefer to not obtain Xcode, then one of the alternative is:
    • obtain Command-Line-Tools1 (CLT) from here, or Load it from App Store in macOS, or use below command, or obtain apple-gcc package via package manager software. CLT is also known as Command Line Developer Tools. Note: installer download is under/near 300 MB, and may need around ~ 2 GB space.
    • inside Terminal1 utility/app, run this command to load CLT:
      xcode-select --install
      • to view installed CLT version number, run this command : pkgutil --pkg-info=com.apple.pkg.CLTools_Executables . If output not-showing verison number or showing msg that “...No receipt...” then CLT is not installed, or its bundled inside+with Xcode. To view pre-installed pkgs you may run : pkgutil --pkgs

● To view toolchain version numbers, directory, etc info, run this command:

gcc -v && llvm-gcc -v && clang -v

● you may also run xcrun clang command, & see what it outputs:

UserMacBook:~ username$  xcrun clang
clang: error: no input files
  • if output is NOT this message clang: error: no input files, then either installation has error or executable files are not in PATH env var correctly.

● Build toolchain (Xcode or CLT) from apple is used (in first stage) to create a software components for openwrt build purpose, then (in second stage) those software components are used to create the final openwrt components, in order to create openwrt firmware, etc, that are widely compatible with cross-platform.

B. View hidden files/folders:

● We need to view full filename, file extensions, all files & directories, etc including hidden ones, very accurately, so that there is lesser mistakes.
● Use Finder to start Terminal1 in macOS:

  • Finder is very similar to Windows-Explorer file-browser app/tool. In macOS > click on any empty area in Desktop screen > then in top-side  menu, click on Window > click on Bring All to Front > in left-pane (in left side column) of Finder, go under Favorites and click on the Applications > then scroll down & go into Utilities sub-folder > then click on Terminal or Terminal.app to start it. macOS Terminal is very similar to Windows Command-Prompt, a command-line interface (CLI) tool.
  • Hotkeys to start Finder instantly : [Alt/Option] + [Command] + [Space-bar] then close the Search tab.
  • Hotkeys to start Terminal instantly : None. ( Note: Keep Terminal running, after a reboot Terminal will auto-start if you check-marked the option: Load previous running apps after reboot ).

● Run below command inside Terminal:

defaults write com.apple.Finder AppleShowAllFiles true
  • above only makes the files viewable inside file-browser software, it does not actually change any file-attributes.

● 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 Finder will auto start, and all hidden files+folders will by-default begin to be shown to user in macOS Finder.

● in macOS Finder or 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, Finder will keep most of the file extension hidden. But we need to see all file's extension to see FULL filename, 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 the Show All Filename Extensions option.


C. Install Package-Manager:

Install any one of the (3rd-party) package manager (pkg-mngr) software in macOS:

(1) Homebrew, or (2) MacPorts, or (3) pkgsrc.

1. Homebrew:
it is opensource & free (3rd-party) pkg-mngr for macOS, etc.

● Notice / WARNING / CAUTION : homebrew is opensource pkg-mngr but this tool is programmed by it's developers to share user's usage & private data with Ggl (including IP-address, which is private & tracking data), Ggl stores user's all data forever for whatever purpose they want to use it for1, 2, homebrew also changes permission where it should avoid1.

  • You can/may avoid (or skip) reading below paragraphs under this “Warning” section, (if you want to).
  • if cigarette can have cancer warning on smoking, then other life-threatning or very harmful or human-rights violating things also needs to have warning / caution / notice label. Excessive data collection & sharing by Ggl & similar other businesses have caused life-threat or grave harms for multiple individuals, (and also in mass-scale). Criminals have-to register & notify various database to show where they are located, and criminals cannot locate themselves close to non-criminals areas. See more info, court case info on Ggl & similar others: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, few more here.
  • Assistance to such mass scale data theft / collection activities are also given & provided by, and supported + promoted by (official/unofficial) partners, supporters & enablers & software developers, etc. All of them are assisting & submitting private1, 2, 3, 4 & tracking data into Ggl & others. So all of our all activities are digitally tracked / recorded (without court warrants), it means we are all inside virtual / cyber / digital jail(s), we are arrested+observed+monitored inside jail(s) without commiting crime and despite our objections to any such jails(s), such (anti privacy-rights, anti freedom/liberty, etc) activities1 are not only unconstitutional in USA1, 2, 3, 4, those activities also violating international1 agreements & laws1, 2, 3 on human-rights1, 2, & such activities also create more opportunities for more mass scale crimes & violations & exploitations, & also create more opportunities to go after (or target) specific individual human/person(s).
  • if you use homebrew: then use OPT OUT option/command in homebrew, to opt out from their data collection/theft of your usage/personal data, and that is not enough, also load specific site connection blocker (to block Ggl Analytic, etc) configuration or settings in your computer or in your firewall app/rule or in your computer's hosts1 file.
    • macOS (until 10.14.x macOS Mojave) uses /etc/hosts file, & macOS (10.15.x) Catalina uses /private/etc/hosts file.
      0.0.0.0 google-analytics.com
      0.0.0.0 www.google-analytics.com
    • sometime above hosts file based solution is not-enough : ip-addresses (and ranges) of Ggl Analytic site need to be blocked carefully via firewall rules, for specific app(s)/tool(s).
  • Most of the time, private data & private tracking-data theft / collection / recording by (Ggl or other) search engine is not possible to block normally at all. Whenever you or an app/tool connects with (Ggl or other) search engine directly to search for something, then that (Ggl or other) search engine can collect / record ip-address, search string, app info, USER-AGENT info, etc various private & tracking data/info, and then some search engine company/corporation (in.example: Ggl) stores such private & tracking data permanently forever. So also see: 1, 2, eff.
  • so to overcome this type of mass-scale & human-rights violating data tracking & theft, you would need to use proxy or VPN or Tor or SSH based indirect connection (or tunnel or network-connection) into (Ggl or other) search engine. Search engine (in.example: Ggl) will still record/steal ip-address tracking (and other private) data (forever) but that will be VPN or Tor or SSH or proxy exit-point's ip-address.
  • do not encourage (your family or) others to expand data theft or digital jail or more abuse or more violation.
    • create (tiny or small or big) barriers/obstacles for greedy monsters & criminals who are recording private data.
      private data is your private property. your voice, your face, your fingerprint, your body, your private-key, your own (personal & private) data, etc are your private property. if any software transfers/stores/copies these private data out of your device into any type of remote server or remote cloud or remote processing, then it violated your privacy rights & other human-rights. ( CPU, GPU, etc are now powerful to process such data inside a computing device. Even if it is slow to process, private data cannot goto remote/cloud location, if it goes then it does not remain “private” anymore, & that is a violation. Privacy & security of private data, etc are more important for human safety than convenience of “fast”/“faster” word based deceptive responses ).
      your family is your family property, your family is not any other family's or any other non-family person's property. but you do not have right to violate human-rights on even your own family members.
      to prevent violations & to prevent spread of harm & to prevent impunity for crimes (or violations), when any private (or public) entity (or association or business) which begins to store/collect multiple other public / person's info, or when begins to do any type of business or when begins to provide service for multiple people/person, then this type of entity (or association or business) MUST be under inspection, oversight, accountability, etc. public element of accountability data must be made available to public, so that public is informed & can take informed decision.
      access to information is human-rights (essential for human brain & healthy mind), in the way: access to water is human-rights (essential for human body).
      if such entity (or association or business) can operate with impunity of their crimes & human-rights violations & consumer-rights violations, then it is not-good & not-beneficial entity in the long run for human (or earth).
      Human-rights violating laws passed by corrupt group of politicians or brainwashed (or ignorant or unbalancely informed) citizens are actually not-good law & actually not-“law” (such is “corruption” & “violation” & “injustice”, “inequality” etc) & such is not-good for human / family / society / community / country / earth in the long run.
      in.example: if you mock or say to a person without shirt, he is inferior than you (or your brother or your father), after you (or your brother or your father) steal the shirt from him (or from his brother or father, who were to give the shirt to him), etc, then YOU are inferior, as loss of shirt situation is created by you (or your brother or your father), you not only abused the person verbally (knowingly or unknowingly), you (or your brother or your father) also deprived the person from what he was to receive.
      And after you create obstacle(s) for recording ip-address tracking, etc data, we strongly request to you/user, that you/user also MUST not engage into any type of human-rights violating or criminal or abusive activities, you/user MUST have to uphold (good) moralities & ethics & humanity that is beneficial for ALL human/people, for earth/environment, etc, for now & future generations.
      Inside cyber (aka: digital, virtual, internet) world, your encryption (aka: crypto) key (or certificate) is your helmet + shirt/jacket + pant + shoe protection/tool to keey your body protected / shielded from natural or artifical harms. Create multiple crypto keys, create multi-layer encrypted connections to destination(s), to create delay in decryption/theft of data. Connect with others in related fields to continue to improve your keys & connection security. Trustworthy beneficial encryption creates protection & safety & security for life-saving devices/tools inside digital/cyber world. Do not support entities who undermine this essential (aka: fundamental) protection.

2. MacPorts:
it is opensource & free (3rd party) pkg-mngr (package manager) for macOS, etc, & it does not steal your usage/private data. MacPorts guide. It can obtain source and binary packages.
● download/obtain MacPorts installer dmg/pkg file, install it. More info here.
● Before MacPorts is installed, your ~/.bash_profile file (inside your home directory) may look close to like this:

# .bash_profile for BASH
# PROMPT_COMMAND=update_terminal_cwd
PS1='\h:\W \u\$ '
PS2='> '
PS4='+ '
PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
export PATH

● MacPorts installer webpage will instruct you to add macports pkg-mngr executable file locations in the end of your PATH variable, like this:

PATH="$PATH:/opt/macports/bin:/opt/macports/sbin"
  • after you add above line manually in ~/.bash_profile file, it will look like below:
    # .bash_profile for BASH
    # PROMPT_COMMAND=update_terminal_cwd
    PS1='\h:\W \u\$ '
    PS2='> '
    PS4='+ '
    PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    PATH="$PATH:/opt/macports/bin:/opt/macports/sbin"
    export PATH
  • you can use this command to edit the ~/.bash_profile file:
    sudo nano ~/.bash_profile

● When MacPorts is installed, installer will add locations in PATH where macports port package executables are stored, inside the ~/.bash_profile file. In that way, your macOS user account can find+use the installed macports port package files, after you login. But we have to change it little bit.
Here is what you will usually see in ~/.bash_profile file (after macports is installed):

# .bash_profile for BASH
# PROMPT_COMMAND=update_terminal_cwd
PS1='\h:\W \u\$ '
PS2='> '
PS4='+ '
PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
PATH="$PATH:/opt/macports/bin:/opt/macports/sbin"
 
##
# Your previous /Users/<YOUR-USER-NAME>/.bash_profile file was backed up as /Users/<YOUR-USER-NAME>/.bash_profile.macports-saved_2021-08-29_at_16:38:31
##
 
# MacPorts Installer addition on 2021-08-29_at_16:38:31: adding an appropriate PATH variable for use with MacPorts.
export PATH="/opt/local/bin:/opt/local/sbin:$PATH"
# Finished adapting your PATH environment variable for use with MacPorts.

Change above codes, into below code:

# .bash_profile for BASH
# PROMPT_COMMAND=update_terminal_cwd
PS1='\h:\W \u\$ '
PS2='> '
PS4='+ '
PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
PATH="$PATH:/opt/macports/bin:/opt/macports/sbin"
 
##
# Your previous /Users/<YOUR-USER-NAME>/.bash_profile file was backed up as /Users/<YOUR-USER-NAME>/.bash_profile.macports-saved_2021-08-29_at_16:38:31
##
 
# MacPorts Installer addition on 2021-08-29_at_16:38:31: adding an appropriate PATH variable for use with MacPorts.
# export PATH="/opt/local/bin:/opt/local/sbin:$PATH"
export PATH
# Finished adapting your PATH environment variable for use with MacPorts.
  • in above we have disabled MacPorts based port package locations from PATH, but locations of MacPorts pkg-mngr itself are kept in PATH. The “PATH” is an essential environment variable which indicates the sequence of directories/folders where to look for a specific (executable) program. The changes we made, will allow newly installed (MacPorts) packages stay out of touch of other software which does not need to use them. These (MacPorts) packages are needed for development/build purpose of OpenWRT, so we will create a separate executable file (env.sh) to load PATH (and other build environment variables), which is suitable for using inside a shell-manager's specific shell TAB(s) only, for openwrt build/development purpose. See step/section F in below for details on creating this env.sh file.

3. pkgsrc:
it is opensource & free (3rd-party) pkg-mngr (package-manager) for NetBSD unix OS, but can also be used by other OS, including macOS/darwin. It can obtain binary packages. Download: dev, Src: gh, More info: wp.

Warning : macOS keeps the default PATH in /etc/paths file, but do not edit/change it, because such change can affect entire or many parts of macOS system. We only need to change build environment only for 1 or 2 shell instance(s), and not for entire macOS system, and also not for all other apps in macOS.

D. Create Dedicated Case-Sensitive Filesystem:

Create a dedicated case-sensitive filesystem for OpenWRT build/compile purpose:
● 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. Execute below commands inside a Terminal shell instance:

cd ~
hdiutil create -size 20g -type SPARSE -fs "Case-sensitive HFS+" -volname OpenWrt OpenWrt.sparseimage
hdiutil attach OpenWrt.sparseimage
  • the command cd ~ in above is taking developer-user inside the HOME directory of user-account in macOS, then OpenWrt.sparseimage file is created there. But if you want to create the SPARSE image file in a different directory, then change the cd ~ line & go inside your preferred volume/directory.

● Optional/Informational:

  • if you want to open the OpenWRT Volume (aka: Drive, aka: Disk) after creating then use below command as 3rd-command line in above:
    hdiutil attach OpenWrt.sparseimage -autoopenrw
  • after a reboot, if OpenWRT volume is not available in your macOS, then run:
    cd ~ && hdiutil attach OpenWrt.sparseimage -autoopenrw
  • if you want to keep the OpenWRT volume always attached, then:
    cd ~ && sudo hdiutil attach OpenWrt.sparseimage -notremovable -autoopenrw
  • if you want to detach (aka: unmount) the OpenWRT volume, then:
    hdiutil detach /Volumes/OpenWrt
  • More info on hdiutil is here.


E. Goto OpenWRT build volume:

Go inside the OpenWRT build volume, with below command, in Terminal:

cd /Volumes/OpenWrt


F. Create location indicator & build environment file:

● Create a file called env.sh inside /Volumes/OpenWrt to indicate location of installed packages. It will also help us to create openwrt build friendly environment, inside a specific shell tab/instance in shell-manager software like Terminal.

  • This is to allow packages from pkg-mngr (which we will install in next step) to be used, instead of the macOS provided ones.

Based on your pkg-mngr (package-manager), follow one of the below appropriate section:

● For x86_64 Apple hardware, & when you have MacPorts pkg-mngr, then create env.sh file with below content, save it inside /Volumes/OpenWrt location:

env.sh
#!/opt/local/bin/bash
PS1='\h:\W \u\$ ';PS2='> ';PS4='+ ';
# Bring PATH lines from the ~/.bash_profile file into below:
PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
PATH="$PATH:/opt/macports/bin:/opt/macports/sbin"
# Adding path of macports port packages, in ahead of others:
PATH="/opt/local/libexec/gnubin:/opt/local/bin:/opt/local/sbin:/opt/local/libexec:/opt/local/x86_64-apple-darwin19.6.0/bin:$PATH";
# Load PATH into currently running shell:
export PATH;
# Load other environment variables:
export JAVA_HOME=/Library/Java/JavaVirtualMachines/openjdk7-zulu/Contents/Home
  • turn the env.sh file an executable shell script file with this command:
    chmod +x /Volumes/OpenWrt/env.sh
  • For MacPorts create MacPorts.sh file in your home ~/ directory with this command:
    sudo nano ~/MacPorts.sh
  • find the PATH variables lines in your ~/.bash_profile file, and add into below content, then copy all from below & paste into ~/MacPorts.sh file. You can also download below code as a file, then change upper 2 PATH variables, to match with your PATH inside your ~/.bash_profile file:
    MacPorts.sh
    #!/opt/local/bin/bash
    PS1='\h:\W \u\$ ';PS2='> ';PS4='+ ';
    # Bring PATH lines from the ~/.bash_profile file into below:
    PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    PATH="$PATH:/opt/macports/bin:/opt/macports/sbin"
    # Bring last PATH line from the /Volumes/OpenWrt/env.sh file into below:
    PATH="/opt/local/libexec/gnubin:/opt/local/bin:/opt/local/sbin:/opt/local/libexec:/opt/local/x86_64-apple-darwin19.6.0/bin:$PATH";
    # Load PATH into currently running shell program:
    export PATH;
    # Load other environment variables:
    export JAVA_HOME=/Library/Java/JavaVirtualMachines/openjdk7-zulu/Contents/Home
  • turn the MacPorts.sh file an executable shell script file with this command:
    chmod +x ~/MacPorts.sh

● For x86_64 Apple hardware, & when you have homebrew, then create env.sh file 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 arm64 (Apple Silicon(M1)) Apple hardware, & when you have homebrew, then create env.sh file with below content:

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


● Optional:

  • you may check homebrew official page or MacPorts-guide if you need more information related to PATH variable, or other info on pkg-mngr.
  • turn env.sh file an executable shell script file: chmod +x /Volumes/OpenWrt/env.sh


G. Install necessary packages:

Install necessary packages via pkg-mngr, packages which help to build openwrt components. Use below commands inside a shell instance/tab in Terminal. Note: Packages will be installed inside macOS default volume, not inside /Volumes/OpenWrt

Based on your pkg-mngr (package-manager) follow one of the below appropriate section:

● if you have homebrew pkg-mngr then run this command:

brew install coreutils findutils gawk grep gnu-getopt gnu-tar wget diffutils git-extras quilt svn make ncurses pkg-config
  • in above, homebrew command does not include the pre-requisites (aka: dependencies) packages mentioned here.

● if you have MacPorts pkg-mngr then run below 2 commands:

source ~/MacPorts.sh
sudo port install libiconv gettext-runtime coreutils findutils gwhich gawk zlib pcre bzip2 ncurses grep getopt gettext-tools-libs gettext diffutils sharutils util-linux libxslt libxml2 help2man readline gtime gnutar unzip zip lzma xz libelf fastjar libusb libftdi0 expat sqlite3 openssl3 openssl kerberos5 dbus lz4 libunistring nettle icu gnutls p11-kit wget quilt subversion gmake pkgconfig libzip cdrtools ccache curl xxhashlib rsync libidn perl5 p5.28-xml-parser p5.30-xml-parser p5-extutils-makemaker p5-data-dumper boost-jam boost boost-build bash bash-completion binutils m4 flex intltool patchutils swig git-extras git openjdk17 openjdk7-zulu luajit libtool glib2 file python27 python310 libzzip mercurial asciidoc sdcc gnu-classpath
  • in above, MacPorts command includes the pre-requisites (aka: dependencies) packages mentioned here. Space initially used by all of these packages : 4,190,442,792 bytes (2.57 GB on disk) for 129,623 items, (as of March-11, 2022). Note: As different packages are continuously modified & improved by their devs or releaser or adopter or maintainer, so their occupying space size & items count will be different in your computer in different time.

● Optional tools via MacPorts:

  • if you need picocom tool to communicate with router via serial adapter/cable1 connection, then:
    sudo port install picocom
  • if you need last stable openssh (aka: ssh), sftp, scp tools for secure communication or file-transfer, then:
    sudo port install openssh
  • if you need TFTP daemon/server (tftpd) to receive files from router, then:
    sudo port install tftp-hpa
  • if you need to use last stable telnet1, ftp, rsh, rlogin, tftp1 tools and corresponding daemons/servers, then:
    sudo port install inetutils
    • if you need other type of bundled packages, then look here: 1.

  • if you need these type of tools, (more info: 1), then:
    sudo port install arm-elf-binutils i386-elf-binutils m68k-elf-binutils mips-elf-binutils x86_64-elf-binutils


H. Optional-step: Start build friendly shell:

macOS by default uses a very old version of bash shell. So, we can+should start a build/compile friendly common last+stable or recent version of bash shell inside macOS-Terminal's specific tab, as such recent version can be obtained & used by most developer users. Shell-manager software Terminal can run multiple shell instances, by using multiple Terminal-tabs. Select one (or more) Terminal-tab(s) to use for openwrt build purpose, then run below command to have same (last+stable) build environment.

● If you installed new bash package, then start new bash shell inside a specific tab in Terminal, (when you have MacPorts based bash package), with this command:

exec /opt/local/bin/bash

● optional:

  • approve/permit new bash shell in macOS with this command:
    echo “/opt/local/bin/bash” | sudo tee -a /private/etc/shells
  • if you want to continue to use the new bash always, then: click on apple symbol in topside apple menu-bar > System Preferences... > Users & Groups > Unlock the 🔒pane > control click on your user-name > select Advanced Options... > then update/change the Login shell into /opt/local/bin/bash > ok.


I. Load build environment:

We need to load build package locations indicator file as shell environment. OpenWRT developing (aka: building, aka: compiling, aka: compilation) is done inside a suitable (aka: build friendly) shell environment. So, we have to allow openwrt build commands to find packages that we installed via pkg-mngr, by loading build package location indicator file env.sh into one of the Terminal shell environment tab, to create that openwrt build friendly & suitable shell environment.

When developing (aka: building, aka: compiling), run below command to set up build-friendly PATH (and other) variable(s). This leaves your system in a clean state without symlinking.

source /Volumes/OpenWrt/env.sh
  • Optional : So from next time or after a reboot, when you want to enter into openwrt build mode, then run below 2 commands inside a specific tab in Terminal, when you have MacPorts based bash package:
    exec /opt/local/bin/bash
    source /Volumes/OpenWrt/env.sh


J. Build:

Now proceed normally, (that is, start to follow build related other steps/procedures shown in parent/previous page).

Other Tools:

Some users may need below some of the tool.

Users who are developing openwrt firmware for Broadcom (BCM) 43xx chipset, (to use in OpenWRT), those users need this b43-fwcutter tool to extract wireless drivers from firmware.

  • More info here.
  • Package manager homebrew has this tool, and MacPorts does not.
    • Users of MacPorts can obtain source1, 2, 3, 4 & compile, or get it1 from FreeBSD pkg.


Golang1: 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


Optional Tools:

optional tools, drivers, software, etc for macOS, to assist into build/compile process, & to increase security.

No need to install these, unless you specifically need such tool/app/utility to assist your build related works. Here is a small list of some optional/extra tools related to openwrt software code build & test & usage & diagnostics, etc, and also list of some optional/extra tools related to network device test/diagnostics, etc to run/use in macOS (apple macintosh operating system) and apple hardware. For more, goto wp.

XQuartz (dev, wp, src, dnld) : it allows cross-platform (GNU-Linux, etc) apps/tools (which were developed to use X11 GUI), to run on macOS & use macOS's native Quartz GUI, etc. Many GUI apps/tools need this. It is opensource tool.

PeaZip (dev, dnld, src, wp, comparison) : it is a free & opensource archiver (zip, compress) & unarchiver (unzip, decompress) app/tool. GUI (Graphical User Interface) based. Allows to create: 7Z, ARC, Brotli, BZ2 (BZip), GZ (GZip), PAQ/ZPAQ, PEA, QUAD/BALZ/BCM, sfx, TAR, WIM, XZ, ZPAQ, ZIP, Zstandard, etc, and peazip allows to Open & Extract 200+ file types: ACE, CAB, DEB, ISO, RAR, UDF, ZIPX, etc.

GnuPG for OSX (dev, dnld) : verifies file's/message's authenticity. GnuPG is aka (also known as) GPG. We need this tool to verify/authenticate downloaded files (or messages) to find-out whether files (or messages) are indeed what actual file (or message) creator/author/developer actually released/shared/created/sent, So this tool will indicate/tell us whether received files (or messages) were modified/altered/changed/abused/corrupted by someone or some-device in the middle of file/msg travel path or during file/msg travel path, or this tool will indicate to us NO modification was done during file/msg travel path. File's (or message's) actual creator/developer shares their (GnuPG/GPG or PGP or OpenPGP based) crypto (cryptographic) digital pub-key file as pub file or as asc file with public. Most trustworthy way to obtain such pub-key is: goto a KSP or conference and meet actual file/msg creator/developer & obtain pub-key file directly, (or else, the next (slightly-less) trustworthy solution is: use WoT & inspect pub-key components to compare & verify a pub-key's authenticity). File/msg creator/developer signs main-file (or main-msg) with their prv-key, & that creates an unique sig (signature) file for a main-file (or main-msg), then file/msg creator/dev shares main-file (or main-msg) & sig-file with public. This (GnuPG) tool can use sig-file, pub-key file, & main-file (or main-msg), & can indicate if the main-file (or main-msg) was actually released by the actual holder of the pub-key, or not. Install a GUI frontend / wrapper for this tool.

  • to know directory location of installed gpg2 which your system will find (via PATH env var) & use, run : which gpg2
  • the GnuPG tool can also be loaded via MacPorts pkg-mngr, when you run this command : sudo port install gnupg2
  • GpgFrontend (dev, src, dnld) : opensource, free tool to authenticate file, to authenticate message, etc. it contains OpenPGP crypto tool and can also function as a frontend / wrapper for GnuPG. See GnuPG for OSX item in above.

DevUtils (dev, dnld, appstore) : it has various functionalities to perform various development related activities. App is free & opensource, but source-code requires a payment.

  • Various tools/apps for Build, Deployment, etc are here: 1.

TimeUTC (AppStore) : it can add a second date & clock in your topside apple  menu bar, to display current UTC time & date. freeware.

FileZilla (dev, dnld, src, comparison) : it is a client app for FTP, FTP over TLS (FTPS), SFTP SSH, SFTP. Opensource & free & GUI based.

ProFTPD (dev, dnld, src) : For FTP / FTPS / SFTP server. opensource & free.

  • And also get web (GUI) based admin interface app proFTPd-admin (from here) for ProFTPD.

Github Desktop for Mac (dev) : allows a developer user to access & collaborate & develop software, etc on Github.com site. GUI based free app.

TextMate (dev, dnld, comparison) : a text editor. Opensource & GUI based free app. Few features : multi tabs, multi windows, regex based search & replacement, etc.

Kate (dev, dnld) : opensource & free code/text editor.

LuLu (dev) : it is GUI based & free & opensource firewall app to control outbound internet data traffic of apps/tools in macOS.

Loading (dev) : it can show a spinning progress wheel in  menu bar when network is being used by app/tool. Clicking the icon can show the apps/tools that are using network, & holding down the option key can show individual processes. Opensource, free & GUI based tool.

OpenSSH (Portable) (dev, src, dnld-src, comparison) : opensource & free. it is a remote-access client tool to connect with SSH-servers1. It can encrypt all traffic into SSH-server to eliminate eavesdropping, connection hijacking, and other attacks, it has large suite of secure tunneling capabilities, several authentication methods, and sophisticated configuration options. Includes ssh, scp, sftp1, ssh-add, ssh-agent, ssh-keygen, ssh-keyscan. Source can be compiled/built in macOS, or download openssh from macports pkg-mngr, or download dependencies via macports & then build/compile. CLI based. Get a GUI wrapper / frontend for this tool.

Fugu (dev, src-2, wp) : a free & opensource & GUI based frontend / wrapper for OpenSSH ssh,sftp,scp, etc commandline tools. Very old, but still useful to handle SSH keys, etc. It is a SFTP client, SSH app.

PuTTY (dev, wp, src, comparison) : it is a free & open-source terminal emulator, serial console and network file transfer tool, & supports several network protocols: SCP, SSH, Telnet, rlogin, and raw socket connection. Actually developed for Windows OS, but has been ported into MacPorts pkg-mngr to use in macOS. GUI based. To install via Macports pkg-mngr, run: sudo port install putty

  • PuTTY in MacPorts needs these dependencies (these wil be auto-loaded by macports): pkgconfig, gtk2. And gtk2 needs these dependenicies: gtk-doc, pkgconfig, perl5, autoconf, automake, libtool, xz, atk, pango, gdk-pixbuf2, gobject-introspection, xorg-libXi, xorg-libXrandr, xorg-libXcursor, xorg-libXinerama, xorg-libXdamage, xorg-libXcomposite, xorg-libXfixes, shared-mime-info, hicolor-icon-theme.

Coccinellida (dev, dnld) : a simple SSH tunnel manager app. opensource, free. GUI based.

STM (SSH Tunnel Manager) (dev, doc, appstore) : it can manage multiple ssh tunnels / connections: local, remote, socks-proxy, etc. it is a GUI based fronend / wrapper for ssh tool, but for socks-proxy it can use builtin ssh on some situations. freeware. not-opensource. GUI based & also frontend for SSH.

OpenVPN Connect (dev, dnld, appstore, community-dnld, wp) : opensource & free. VPN (virtual private network) connector client tool. GUI based. (There are many other types of VPN1 connector client/server app/tool).

TunnelBlick (dev) : a free & opensource & GUI based frontend / wrapper for OpenVPN commandline tool.

WireShark (dev, dnld, src, comparison, wiki) : it is a network data packet analyzer (aka: network protocol analyzer = NPA) software. Opensource, free & GUI based.

VirtualBox (dev, dnld, comparison2) : a free & opensource & GUI based virtualizer software (from Oracle) to create (software based) virtual-machine (VM) inside a hardware based host machine. So with this app, user can run+use multiple+different operating systems (OS) simultaneously. User can create VM as client, VM as server, client+server VM, Desktop OS VM, Mobile OS VM, etc, etc. First version used codes from QEMU. It can emulate these (hardware) architectures as VM: x86, x86-64.

QEMU (dev, dnld, src, wp) : it is free & opensource. It is a generic & open source machine emulator and virtualizer. It can emulate various (hardware) architectures as VM, such as: x86, x86-64, MIPS64 (up to Release 6), SPARC (sun4m and sun4u) (32/64), ARM (Integrator/CP and Versatile/PB), SuperH, PowerPC (PReP and Power Macintosh), ETRAX CRIS, MicroBlaze, and RISC-V, OpenRisc32, Alpha, LM32, M68k, S/390, SH4, Unicore32, Xtensa, etc.

NTFS for Mac (Microsoft NTFS for Mac By Tuxera) (dev) : The functionality or ability to read NTFS partitions inside macOS is very helpful feature to transfer file(s) between Windows NTFS partition HDD/SSD and your APFS (apple macOS file-system). This “NTFS for Mac” by Tuxera tool is not free (aka: as freedom of software), it is proprietary (non-opensource) tool. Only trial version is freeware for 15days, tiral version has some helpful functionalities. Full functionalities (after 15 days trial) requires a payment.

  • HDD/SSD storage device MFR (aka: manufacturers) also includes NTFS for Mac (Microsoft NTFS for Mac By Paragon1, etc) software for macOS, with their some HDD/SSD storage device, So if you purchased such HDD/SSD or if your HDD/SSD drive (in your computer) matches with MFR's such HDD/SSD then you may use that full-version NTFS for Mac (by Paragon) software (by obtaining it from HDD/SSD MFR's website). a 10-day trial-version is here: 1.
  • Earlier helpful software FUSE for macOS1, 2, 3 is not anymore free (as in freedom of software) for macOS, it is now proprietary for macOS. The Mounty for NTFS1 and NTFS-3G1, 2 are free & opensource, but slow. Linux kernel v5.15 & onward has began to support NTFS1 3.1 & earlier versions, NTFS driver was provided by Paragon.

GPT fdisk (gdisk) (dev, dnld, list) : opensource & free partition manager tool. gdisk has TUI (text-based semi-graphical user interface) interface. gdisk can edit GUID partition table (GPT) definitions in Linux, FreeBSD, MacOS X, or Windows, it can convert MBR to GPT without data loss, convert BSD disklabels to GPT without data loss, create hybrid MBR or convert GPT to MBR without data loss, repair damaged GPT data structures, repair damaged MBR data structures (FixParts). macOS 10.11.x (“El Capitan”) and later created some areas (and layers) of partitions “rootless”, so users need to either disable1 SIP (System Integrity Protection), or Run it from a bootable USB/CD/DVD storage disk/media (by using partition manager tools like: PartedMagic1). Obviously using trustworthy bootable disk is better idea+method. gdisk can work on external / USB media / disk / drive fine (without disabling SIP in macOS). it can also be installed via MacPorts pkg-mngr: sudo port install gptfdisk

  • Paragon Hard Disk Manager for Mac (dev) : it is a commercial & non-opensource software, GUI based. it can manage drive/disk partitions. a 10-day trial version is here for macOS. A community edition of (Paragon Partition Manager) is avilable which is not-trial & can continue to function for non-commercial use purpose only, but available only for Windows 7 & higher OS, here.

UNetbootin (dev, dnld2, list, comparison) : opensource & free boot disk creator. GUI based. it allows to create bootable Live USB drives for booting Ubuntu, Fedora, and other Linux distributions without burning a CD. It can run on (Windows, Linux, and) macOS. You can either let UNetbootin download one of the many distributions supported out-of-the-box for you, or you can supply your own (Linux, etc) .iso file.

Clonezilla (dev, src, dnld, comparison-(clone), comparison-(img), list-(clone), list-(recovery) ) : it is opensource & free tool to clone/backup/copy drive & partitions, from Linux OS. it has TUI (text-based semi-graphical user interface) based interface. Supports: FAT12, FAT16, FAT32, NTFS, ext2, ext3, ext4, ReiserFS, Reiser4, xfs, jfs, btrfs, f2fs, NILFS2, HFS+, UFS, minix, VMFS3. Obtain Clonezilla's bootable disk img file from Clonezilla dev site, After you boot from that, it will load Debian Linux & it will run Clonezilla. Usually it can be used on (almost) any computer (including Mac). Notice: Partitions which are proprietary & very recent & no API/access solution is yet found, support for those partitions are not yet available in this software.

  • You can also use (opensource) RescueZilla1 which is a Clonezilla GUI version from another developer, obtain from here: 1, (it also requires booting from USB/external media/disk). You can also try (opensource) Redo Rescue1 (formerly “Redo Backup & Recovery”) software from here: dnld src, it is partly based on Clonezila, (and it also requires booting from USB/external media/disk).
  • Acronis True Image 2021 for Mac (dev) : it is non-opensource & commercial software to clone/backup/copy drive & partitions. GUI based. 30-day trial version is available here. Supports: FAT32, NTFS, HFS+, APFS, ext2, ext3, ext4 and ReiserFS. Some HDD/SSD storage drive MFR (manufacturers) include this with their HDD/SSD, so if you've purchased drive or if your drive in your computer matches thier drive, then you can obtain the full-version from HDD/SSD MFR's website.

Deluge (dev, dnld, comparison) : a bittorrent network based file-sharing software. free & opensource. Encrypt or Password protect files before sharing, & share password via a separate (private) channel. Filename can have contact info if you wish to be contacted, but remember that such contact info will also be abused by someone out there. More info here.

Thunderbird (dev, dnld, src, comparison) : multi data communication-protocol supporting client, but more commonly known as an Email client app (for viewing, reading, sending emails), so it is a PIM1/PDM1 client (that supports personal/private information like: emails, address-book, calendar dates, emails, instant messages, passwords, alerts, browsing site data, etc, etc). Thunderbird is free & opensource. It is also client app/tool for: newsfeeds1/newsgroups1, 2 (NNTP1 client, NNTPS) , web feeds1, 2 (news aggregators1, like: Atom1, RSS1, etc) client, instant messaging1 (aka: chat1 networks, like IRC1, XMPP1, Google-Talk, Twitter, Odnoklassniki, etc) client, address auto-completion (LDAP) client, etc. Thunderbird contains core/engine of Mozilla Firefox web-browser, which allows thunderbird to connect with various types of web-servers / web-sites to use various web-services, as a HTTP/HTTPS, & other protocols cleints, and firefox web-browser core also allows thunderbird to open1, 2, 3 multiple web-browser tab(s) (inside thunderbird) to be used by users, manually. Send yourself email (or chat-msg) with URL-links to various web-site services, then inside thinderbird right-click on link (inside email or chat-msg) & select the option to open the link inside a New Tab inside thunderbird1, in this way you can use/access various WebMails1, 2, Twitter1, etc. More info on how to approve cookies & JS for such web-service website and dependent 3rd-party web-services (inside thunderbird), are explained here. Thunderbird addons can also allow access to various web-services more easily: Google-Chat1, Skype-WebApp1, Telegram-Web1, 2. This type of app is very helpful to keep multi channel communications with openwrt & other various project developers, and to test your own servers. Get firefox addon uBlock Origin1, & load into Thunderbird, that addon allows you to stop un-approved Advertisements that are using+stealing your computing (CPU, GPU, etc) resources, & internet (limited & costly) data allotments from your ISP, etc, without your consent/permission/approval, and these advertisers also DO NOT PAY you any FEE after they used your computing & data resources.

Apparency (dev, dnld) : it can inspect software application bundles (pkg, app, etc) for macOS, & then it can show info on code signing requirements, notarization, signatures, included frameworks, etc. it is a freeware.

AppCleaner (dev) : open Finder > goto Application in any finder-tab > open this AppCleaner app, then drag the app that you want to remove/uninstall from Application folder/directory, & drop it inside the AppCleaner, it will inspect & find-out & show all elements used by that unwanted app, & also show you option to Remove. it is freeware.


various (opensource) drivers for macOS, are mentioned (with website links) in this page, inside the topside macOS & Darwin Unix section.

Serial-to-UART, USB-to-UART, USB-to-JTAG, etc cable/adapter's macOS/darwin drivers, to communicate with router (from apple mac computer), are usually provided by the cable/adapter device's manufacturer. a slow but opensource serial-to-UART driver is also available. For more info goto here.

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
  • Last modified: 2022/04/02 06:38
  • by aterik