[Libguestfs] Notes on getting libguestfs to work on Mac OS X

Richard W.M. Jones rjones at redhat.com
Thu Oct 17 14:04:42 UTC 2013


More complete documentation below.

Rich.

----------------------------------------------------------------------
libguestfs on Mac OS X (tested with libguestfs-1.23.33):
--------------------------------------------------------

prerequisites:
--------------
- install osxfuse, download from: http://osxfuse.github.io
- install some dependencies using macports: sudo port install qemu cdrtools pcre augeas
- extract appliance to /usr/local/lib/guestfs/, download from: http://libguestfs.org/download/binaries/appliance/

patches:
--------
- libtool-kill-dependency_libs.sh: replace - chmod --reference="$output.tmp" "$output" -> chmod `stat -f "%p" "$output.tmp"` "$output"

- src/proto.c: replace - if (!(*xdrp) (&xdr, args)) -> if (!(*xdrp) (&xdr, args, 0))
- src/proto.c: replace - if (xdrp && ret && !xdrp (&xdr, ret)) -> if (xdrp && ret && !xdrp (&xdr, ret, 0))
- src/launch-direct.c: comment out - if (qemu_supports (g, data, "-nodefaults")) ADD_CMDLINE ("-nodefaults");

- fuse/guestunmount.c: replace - execlp ("fusermount", "fusermount", "-u", mountpoint, NULL); -> execlp ("/sbin/umount", "fusermount", mountpoint, NULL);
- fuse/guestunmount.c: replace - execlp ("/sbin/fuser", "fuser", "-v", "-m", mountpoint, NULL); -> execlp ("/usr/bin/fuser", "fuser", "-c", mountpoint, NULL);

- gnulib/lib/error.c: replace - extern char *program_name; -> extern char *program_name = "libguestfs";
- gnulib/lib/open_memstream.c: add new file, from http://lists.gnu.org/archive/html/bug-gnulib/2010-04/msg00379.html, remove from it check for #if !HAVE_FUNOPEN (it exists on Mac OSX, but HAVE_FUNOPEN is not defined)
- gnulib/lib/stdio.in.h: add somewhere (for example, before @GNULIB_PCLOSE@): _GL_FUNCDECL_SYS (open_memstream, FILE *, (char **, size_t *));
- gnulib/lib/Makefile.in, replace: openat-die.lo -> open_memstream.lo openat-die.lo
- gnulib/lib/Makefile.in, replace: openat-die.c  -> open_memstream.c openat-die.c

configure:
----------
- use: ./configure --disable-appliance --disable-daemon --disable-probes --disable-ruby --disable-php CFLAGS="-I/opt/local/include" LDFLAGS="-L/opt/local/lib" LIBS="-lintl" FUSE_CFLAGS="-I/usr/local/include/osxfuse/fuse -D_FILE_OFFSET_BITS=64" FUSE_LIBS="-losxfuse"

make, test & install:
---------------------
- make
- LIBGUESTFS_PATH=/usr/local/lib/guestfs/appliance make quickcheck
- sudo make install

use:
----
- LIBGUESTFS_PATH=/usr/local/lib/guestfs/appliance guestfish
or
- LIBGUESTFS_PATH=/usr/local/lib/guestfs/appliance guestmount
----------------------------------------------------------------------

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.
http://people.redhat.com/~rjones/virt-df/




More information about the Libguestfs mailing list