UNFINISHED: Getting libguestfs to work on MacOS with Golang

Originally posted on 2024-01-01

This is annoying but necessary…

Step 1: Get genisoimage by installing cdrtools and symlinking mkisofs to it

brew install cdrtools
ln -s /opt/homebrew/bin/mkisofs /opt/homebrew/bin/genisoimage
hash -r

Step 2: Install augeas and libmagic (guidance on libmagic from a gist)

brew install augeas libmagic
brew link libmagic
# NOT WORKING - env ARCHFLAGS="-arch x86_64" gem install ruby-filemagic -- --with-magic-include=/usr/local/include --with-magic-lib=/usr/local/lib/
# NOT WORKING - gem install ruby-filemagic -v '0.7.2' --source 'https://rubygems.org/' -- --with-magic-include=/opt/homebrew/include --with-magic-lib=/opt/homebrew/lib/
# NOT WORKING - pip install python-magic
# NOT WORKING - pip install python-magic-bin
# NOT WORKING - brew install file

Step 3: Clone the Golang library and build it

git clone https://github.com/MuralidharB/libguestfs-1.44.1.git
cd libguestfs-1.44.1
export GO111MODULE=auto