Building AGL Development Enviornment on Mac: 1. Build Yocto using Docker in 2025
Step-by-step: use Docker on macOS to create a persistent workdir volume, expose via Samba, and run the poky/poky-like container to build Yocto (2025 notes).
Overview
This post documents how to set up a Yocto build environment on macOS using Docker (updated notes for 2025). The approach uses a Docker volume for the work directory, a small Samba container to expose the volume to Finder, and a Yocto/poky container for interactive build work.
Follow the commands exactly in a macOS terminal. Where sudo is required you’ll be prompted for your password.
1. Install and run Docker for Mac
Install Docker Desktop for Mac and ensure it runs. Follow the official Docker documentation:
- Install and start Docker Desktop: https://docs.docker.com/docker-for-mac/
Once Docker Desktop is running, open a terminal.
2. Start a terminal
You can open the default macOS Terminal by pressing Command–Space and typing Terminal.
3. Create the volume
Create a Docker volume named myvolume. This will hold the Yocto workspace so it persists across containers.
docker volume create --name myvolumeSet ownership inside the volume to uid 1000:1000 so container users match a common Linux uid/gid (some images expect non-root users):
docker run -it --rm -v myvolume:/workdir busybox chown -R 1000:1000 /workdir4. Create and run a Samba container
Create a lightweight Samba container that mounts the myvolume volume and exposes it on port 445 so you can access it from Finder.
docker create -t -p 445:445 --name samba -v myvolume:/workdir crops/sambaStart the Samba container:
docker start samba5. Create an alias for 127.0.0.1
macOS will not let you directly connect to a locally-hosted Samba share at 127.0.0.1, so create an alias address on the loopback interface (127.0.0.2) and use that to connect.
sudo ifconfig lo0 127.0.0.2 alias upTip: combine starting samba and creating the alias in one command for convenience:
docker start samba && sudo ifconfig lo0 127.0.0.2 alias upNote: The alias is ephemeral and will be removed on reboot. If you need it persistently, consider adding an appropriate boot-time script (e.g., a LaunchDaemon), or re-run the alias command when needed.
6. Open the workdir in Finder
Open Finder, press Command–K (Connect to Server), and enter:
smb://127.0.0.2/workdirSelect “Guest” login and click “Connect”. You should now see the workdir contents in Finder. This makes it easy to edit files from your macOS editor while builds run inside containers.
7. Start a container to do work
Now run your Yocto/poky container and mount the same myvolume volume at /workdir. The container can be started with the workdir set as the starting directory so you land in the shared workspace immediately.
For generic Yocto/poky work:
docker run --rm -it -v myvolume:/workdir crops/poky --workdir=/workdirFor AGL development (recommended for this series):
docker run --rm -it -v myvolume:/workdir dnangellight/agl-poky-dev:latest --workdir=/workdirNotes:
- The
--workdir=/workdirflag causes the container to start in that directory. The container will honor the uid/gid mapping previously set on the volume (uid 1000 in our chown step). - The
dnangellight/agl-poky-dev:latestcontainer comes pre-configured with all AGL development tools including git, curl, python3, and the repo tool.
When successful you should see a prompt like:
agluser@3bbac563cacd:/workdir$(or pokyuser@... if using the crops/poky container)
From here you can fetch layers, configure builds, and run bitbake inside the container. Files edited in Finder will be visible immediately inside the container because they share the same volume.
8. Use Git to clone Poky
Once inside the container, you need to get a copy of the Poky repository. Use the following commands to clone it:
git clone git://git.yoctoproject.org/pokyYou’ll see output like:
Cloning into 'poky'...remote: Counting objects: 432160, done.remote: Compressing objects: 100% (102056/102056), done.remote: Total 432160 (delta 323116), reused 432037 (delta 323000)Receiving objects: 100% (432160/432160), 153.81 MiB | 8.54 MiB/s, done.Resolving deltas: 100% (323116/323116), done.Checking connectivity... done.Go to the Yocto Project Releases wiki page and choose a release codename corresponding to either the latest stable release or a Long Term Support release (e.g., walnascar, dunfell, gatesgarth).
Move to the poky directory and check existing branches:
cd pokygit branch -aYou’ll see output like:
remotes/origin/HEAD -> origin/masterremotes/origin/dunfellremotes/origin/dunfell-nextremotes/origin/gatesgarthremotes/origin/gatesgarth-nextremotes/origin/masterremotes/origin/master-nextFor this example, check out the walnascar branch based on the Walnascar release:
git checkout -t origin/walnascar -b my-walnascarOutput:
Branch 'my-walnascar' set up to track remote branch 'walnascar' from 'origin'.Switched to a new branch 'my-walnascar'This creates a local branch named my-walnascar. The files in that branch exactly match the repository’s files in the walnascar release branch.
Note: You can regularly sync your local files with the release branch by running:
git pull9. Initialize the build environment
From within the poky directory, run the oe-init-build-env environment setup script to define Yocto Project’s build environment:
cd pokysource oe-init-build-envYou’ll see output like:
You had no conf/local.conf file. This configuration file has therefore beencreated for you with some default values. You may wish to edit it to, forexample, select a different MACHINE (target hardware). See conf/local.conffor more information as common configuration options are commented.
You had no conf/bblayers.conf file. This configuration file has thereforebeen created for you with some default values. To add additional metadatalayers into your configuration please add entries to conf/bblayers.conf.
The Yocto Project has extensive documentation about OE including a referencemanual which can be found at: https://docs.yoctoproject.org
For more information about OpenEmbedded see their website: https://www.openembedded.org/
### Shell environment set up for builds. ###
You can now run 'bitbake <target>'
Common targets are: core-image-minimal core-image-full-cmdline core-image-sato core-image-weston meta-toolchain meta-ide-support
You can also run generated QEMU images with a command like 'runqemu qemux86-64'
Other commonly useful commands are: - 'devtool' and 'recipetool' handle common recipe tasks - 'bitbake-layers' handles common layer tasks - 'oe-pkgdata-util' handles common target package tasksNote: If you are working behind a firewall and your build host is not set up for proxies, you could encounter problems with the build process when fetching source code (e.g., fetcher failures or Git failures). Consult your local network infrastructure resources for proxy settings, or check the Yocto Project Wiki page on Working Behind a Network Proxy.