-
Notifications
You must be signed in to change notification settings - Fork 138
Building AVRDUDE for macOS
On macOS, you can normally install AVRDUDE through MacPorts (port install avrdude
) or Homebrew (brew install avrdude
).
The following things are needed to build AVRDUDE on MacOS:
- A C compiler; either full XCode, or the XCode Command Line tools
- cmake, pkg-config, hidapi, libftdi1, libusb, libelf, libserialport (libserialport is not available with MacPorts, so you have to build from source)
(note: alternative to pkg-config is pkgconf, both should work but you can install one of them).
Minimum required version for CMake is 3.14.
The following two build systems are supported.
To build AVRDUDE for macOS using MacPorts, run the following commands:
port install cmake pkg-config hidapi libftdi1 libusb libusb-compat libelf libserialport
git clone https://github.com/avrdudes/avrdude.git
cd avrdude
./build.sh
To build AVRDUDE for macOS using Homebrew for macOS Intel or macOS Apple Silicon, run the following commands:
brew install cmake pkg-config hidapi libftdi libusb libusb-compat libelf libserialport
git clone https://github.com/avrdudes/avrdude.git
cd avrdude
./build.sh
macOS ships libedit which is a replacement of GNU Readline. As of Dec 2022, with the various fixes in place, libedit is considered as good enough for macOS for the purpose of avrdude, GNU Readline is not required.
In case you still prefer to use GNU Readline, you can follow the instructions below.
brew install cmake hidapi libftdi libusb libusb-compat libelf readline libserialport
git clone https://github.com/avrdudes/avrdude.git
cd avrdude
(for macOS Intel)
cmake -D CMAKE_C_FLAGS=-I/usr/local/include -D CMAKE_EXE_LINKER_FLAGS=-L/usr/local/Cellar -D HAVE_LIBREADLINE:FILEPATH=/usr/local/opt/readline/lib/libreadline.dylib -D CMAKE_BUILD_TYPE=RelWithDebInfo -B build_darwin
(for macOS Apple Silicon)
cmake -D CMAKE_C_FLAGS=-I/opt/homebrew/include -D CMAKE_EXE_LINKER_FLAGS=-L/opt/homebrew/Cellar -D HAVE_LIBREADLINE:FILEPATH=/opt/homebrew/opt/readline/lib/libreadline.dylib -D CMAKE_BUILD_TYPE=RelWithDebInfo -B build_darwin
cmake --build build_darwin
port install cmake hidapi libftdi1 libusb libusb-compat libelf readline libserialport
git clone https://github.com/avrdudes/avrdude.git
cd avrdude
cmake -D CMAKE_C_FLAGS=-I/opt/local/include -D CMAKE_EXE_LINKER_FLAGS=-L/opt/local/lib -D CMAKE_BUILD_TYPE=RelWithDebInfo -B build_darwin
cmake --build build_darwin
To install a local build on your system for MacPorts, run the following commands:
sudo cmake --build build_darwin --target install
Example run log.
mcuee@mcuees-Mac-mini ~ % brew install avrdude
==> Downloading https://formulae.brew.sh/api/formula.jws.json
############################################################################################################################# 100.0%
==> Downloading https://formulae.brew.sh/api/cask.jws.json
############################################################################################################################# 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/avrdude/manifests/7.3
Already downloaded: /Users/mcuee/Library/Caches/Homebrew/downloads/dd48fff588b18c1065949ff85a7e767286dc3c96de049b1e8ef6bba405763ae1--avrdude-7.3.bottle_manifest.json
==> Fetching avrdude
==> Downloading https://ghcr.io/v2/homebrew/core/avrdude/blobs/sha256:7e4fbdde7efdd2122c7668c7ad8997c58c6f84577cd9622677eb2c09e0db48
############################################################################################################################# 100.0%
==> Pouring avrdude--7.3.arm64_sonoma.bottle.tar.gz
🍺 /opt/homebrew/Cellar/avrdude/7.3: 14 files, 7.5MB
==> Running `brew cleanup avrdude`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
mcuee@mcuees-Mac-mini ~ % brew install avrdude --HEAD
Error: avrdude 7.3 is already installed
To install HEAD, first run:
brew unlink avrdude
mcuee@mcuees-Mac-mini ~ % brew unlink avrdude
Unlinking /opt/homebrew/Cellar/avrdude/7.3... 7 symlinks removed.
mcuee@mcuees-Mac-mini ~ % brew install avrdude --HEAD
==> Fetching avrdude
==> Downloading https://raw.githubusercontent.com/Homebrew/homebrew-core/b48fd4fca1f9a6988fb5058355df27d8d5651145/Formula/a/avrdude.
############################################################################################################################# 100.0%
==> Cloning https://github.com/avrdudes/avrdude.git
Updating /Users/mcuee/Library/Caches/Homebrew/avrdude--git
==> Checking out branch main
Already on 'main'
Your branch is up to date with 'origin/main'.
HEAD is now at 5c1649dc Update NEWS
==> cmake -S . -B build/shared -DCMAKE_INSTALL_SYSCONFDIR=/opt/homebrew/etc -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_RPATH=@loader_pat
==> cmake --build build/shared
==> cmake --install build/shared
==> cmake -S . -B build/static -DCMAKE_INSTALL_SYSCONFDIR=/opt/homebrew/etc
==> cmake --build build/static
🍺 /opt/homebrew/Cellar/avrdude/HEAD-5c1649d: 13 files, 6.8MB, built in 9 seconds
==> Running `brew cleanup avrdude`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
Removing: /Users/mcuee/Library/Caches/Homebrew/avrdude--7.3... (1.6MB)
From now on, you can use brew reinstall avrdude
to catch up with git main.
./bootstrap
./configure CFLAGS=-I/opt/homebrew/include LDFLAGS=-L/opt/homebrew/lib (Homebrew Apple Silicon)
./configure CFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib (Homebrew x86_64)
./configure CFLAGS=-I/opt/local/include LDFLAGS=-L/opt/local/lib (MacPorts)
make
For the next build, you may want to run make clean
first.