Build for macOS
We've been using gtk-osx to make the OS X binaries in the nip2 release area.
We have a OS X build system based on jhbuild that automates the whole process. Check the README.
VIPS is on homebrew. Install homebrew and type:
$ brew install vips
To verify your vips install, try:
$ vips --version
vips-8.6.3-Thu Mar 8 15:18:35 UTC 2018
This is a good way to get libvips on your system, not so great for nip2.
This will give you a vips with just the basic optional packages, missing things like imagemagick loading, openslide support, and so on. To get a list of all the optional dependencies, try:
$ brew info vips
For a full-fat version, try:
$ brew install vips --with-cfitsio --with-imagemagick --with-openexr --with-openslide --with-webp
vips will also work with graphicsmagick, which you may prefer. Swap
--with-imagemagick
for --with-graphicsmagick
to use that library.
Python should just work, as long as you use the homebrew Python and not the Apple one. You should see:
$ which python
/usr/local/bin/python
If you want to build things outside homebrew which depend on vips, such as
ruby-vips, you will need to get your
pkg-config
working. You need to point
pkg-config
at the homebrew area, and, additionally, at various homebrew
add-on areas.
In your .profile, add something like:
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/local/opt/libxml2/lib/pkgconfig:/opt/X11/lib/pkgconfig:/usr/local/opt/libffi/lib/pkgconfig
To verify that pkg-config
is working correctly with vips, try:
$ pkg-config vips --libs
-L/usr/local/Cellar/vips/7.32.1/lib ... a lot of stuff
To build from source yourself on OS X, first install via homebrew to pull in the necessary packages, then uninstall, clone the git repository and build yourself.
Roughly:
brew install homebrew/science/vips --with-webp --with-graphicsmagick
brew uninstall vips
brew install openexr openslide homebrew/science/libmatio cfitsio libjpeg-turbo
Now set up your environment for building outside brew. You need to set
PKG_CONFIG_PATH
, I have something like this in my .profile
:
function addpkg() {
export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$1/pkgconfig"
}
export PKG_CONFIG_PATH=
addpkg /usr/local/lib
addpkg /usr/local/opt/libxml2/lib
# we use xquartz: cairo needs those .pc as well
addpkg /opt/X11/lib
addpkg /usr/local/opt/libffi/lib
You need to set PATH
to search /usr/local/
. I usually build development
versions of vips to a private area in my home, so I add that as well.
export VIPSHOME=$HOME/vips
export PATH=/usr/local/bin:$VIPSHOME/bin:$PATH
addpkg $VIPSHOME/lib
You have to tell Python and gobject-introspection about the private vips area:
export GI_TYPELIB_PATH=/usr/local/lib/girepository-1.0:$VIPSHOME/lib/girepository-1.0
export PYTHONPATH=$VIPSHOME/lib/python2.7/site-packages:$PYTHONPATH
You need some extra packages to build vips from GIT:
brew install autoconf automake gtk-doc swig
And now you can finally clone and build vips.
git clone git@github.com:jcupitt/libvips.git
cd libvips
CFLAGS="-g -Wall" CXXFLAGS="-g -Wall" ./autogen.sh --prefix=$HOME/vips --with-jpeg-includes=/usr/local/opt/jpeg-turbo/include --with-jpeg-libraries=/usr/local/opt/jpeg-turbo/lib
The vips Python binding won't be able to install Vips.py
for you, you
need to do this by hand.
cd python
cp Vips.py /usr/local/lib/python2.7/site-packages/gi/overrides/
VIPS and nip2 are available via Fink. To install the nip2 end user program, type
fink install nip2
To use VIPS outside of Fink, you'll need the development package
libvips31-dev
(for VIPS version 7.34.2). The VIPS tools are in
libvips-tools
. To verify your vips install, try:
$ vips --version
vips-7.34.2-Tue Oct 1 19:42:09 EDT 2013
In order for your project to find the library, add /sw/lib/pkgconfig
(replace "/sw" as appropriate for your Fink install root) to the environment
variable PKG_CONFIG_PATH:
export PKG_CONFIG_PATH=/sw/lib/pkgconfig:$PKG_CONFIG_PATH
To verify that pkg-config is working correctly with vips, try:
$ pkg-config vips --libs
-L/sw/lib -lvips ... a lot of stuff
VIPS and nip2 are in Macports. Follow the install instructions, then:
$ sudo port install vips
$ sudo port install nip2
That will make a nip2 which uses X11 for display. You can make a nip2 that uses the native OS X backend like this:
$ sudo port install nip2 +no_x11 +quartz