This page provides further detail on compiling and installing GnuCash using MacPorts. For the overview of Mac installation options, see MacOSInstallation.
- 1 MacPorts installation in detail
- 2 Using MacPorts to install a recent stable release of GnuCash
- 3 Using MacPorts to install the native Quartz version of GnuCash
- 4 Potential Problems and their Solutions
- 5 Current developer version
- 6 Compiling on your own
MacPorts installation in detail
Install the latest Developer Tools from Apple - a.k.a. XCode
- Download the latest version from http://developer.apple.com/ (free registration is required).
- You don't need to install all of the packages - use the 'Customize' button in the installer and only select:
- Developer Tools Software
- gcc 4.0
- gcc 3.3
- Software Development Kits (installed with Developer Tools)
- Unix Development Support (includes gcc)
(As of Dec 2008, you may need gcc4.2 as well; and I'm not sure if gcc3.3 is even extant any more. So a standard install may be the safest route -- that definitely works fine.)
- Download and install the latest version of MacPorts
- Make sure you update all the package descriptions so you can get the latest GnuCash:
sudo port selfupdate
Using MacPorts to install a recent stable release of GnuCash
Once that's done, you can issue the following command to install GnuCash - this will take you quite a while, as the software will be downloaded, then compiled and installed. It took a good 6 hours on my iBook. The whole installation of MacPorts with GnuCash adds up to about 1GB.
$ sudo port install gnucash
If this works for you, you can skip the rest of this section (but you may want to look at the Quartz instructions below). Congratulations!
As of December 2008, this was up-to-date with GnuCash-2.2.8, and the font problems appeared to be gone; but I have left the discussion below in case it still crops up for someone else.
At an earlier date, there was a report that on a fresh install of MacPorts, the installation did stall with the 'scrollkeeper' package, but you can just run the same install command again. So if the installation does fail on one of the required packages, try re-running the same install command again before looking further.
As of August 2008, Leopard 10.5.4, and GnuCash-2.2.5 the above still works. But the fonts are too small to be useful on my 15" intel powerbook.
There may be an easier way to change fonts in a default install, but this worked--
Install the X11-2.3.0.pkg from Xquartz.
Log out and back in for the new X11 to take effect.
Change the startx script to use bigger fonts by default.
sudo pico /usr/X11/bin/startx
In the startx script, change defaultserverargs=" " --to-- defaultserverargs="-dpi 96"
Close any X11 that is running.
At the OS X Terminal.app window enter the command "gnucash"
Using MacPorts to install the native Quartz version of GnuCash
As of December 2008, MacPorts can also handle compiling and building the native Quartz version of GnuCash, which does not require or invoke X-Windows at all. To configure MacPorts to compile GnuCash in this fashion, you need only insert one additional step after installing MacPorts and before executing "sudo port install gnucash" (or any other port install commands for that matter):
Edit the file /opt/local/etc/macports/variants.conf and add the following four lines:
+no_static +no_x11 -x11 +quartz
Then save the file, and now you can execute "sudo port install gnucash". You will probably receive a message about dbus at the end of the installation. Ignore it. Instead restart your computer.
If the restart does not work uninstall GnuCash, then install dbus separately, run the command it tells you to for your user (not using sudo). Afterwards reinstall GnuCash.
$ sudo port uninstall gnucash $ sudo port install dbus $ launchctl load /Library/LaunchAgents/org.freedesktop.dbus-session.plist $ sudo port install gnucash
If you have any trouble with the qt3 or aqbanking ports, and you don't need HBCI support (mostly for German electronic banking access), try the following:
$ sudo port clean gnucash $ sudo port install gnucash +without_hbci
If you have already installed GnuCash or components such as gtk2 without these modifications to variants.conf, the road is bumpier. It is not really possible to mix X11-enabled and X11-free versions of these components in the MacPorts package system at the moment. If you can afford to do it, completely uninstalling MacPorts altogether and doing a fresh clean install from scratch is the most reliable way to get a working Quartz-native GnuCash. If you have other MacPorts ports installed that you can't blow away, you can try the following approach:
$ sudo port uninstall --follow-dependents cairo $ sudo port uninstall --follow-dependents dbus
Note that these commands may uninstall some of your favorit programs other than gnucash, if they also depend on cairo or dbus. But that is unavoidable, as two different versions (X11 vs. Quartz) of these two packages cannot coexist. Once the above uninstalls have succeeded, you can edit variants.conf as described above, and then do "sudo port install gnucash" and hopefully enough will have been cleared away for the new build and install to go cleanly and produce a working X11-free version of GnuCash.
Note that once you have a working GnuCash installation under MacPorts, upgrading when the port for a new release has been published is easy: simply do
$ sudo port selfupdate $ sudo port upgrade gnucash
But this process will not change an X11 install to a Quartz one or vice-versa -- it will simply update your existing install to the latest ported release of GnuCash, leaving its type the same.
Potential Problems and their Solutions
The default installation of GnuCash using MacPorts enables everything, including things you might not need, or things that might even cause trouble. In particular, a few people have reported problems installing libraries required for OFX.
The following command tries to install a minimalistic version of GnuCash:
$ sudo port install gnucash +without_hbci +without_ofx +without_quotes
The current MacPort version does not install on Leopard, due to a bug in the avahi port, which gnucash depends on. (See Ticket #13212.) This problem can be sidestepped by disabling python in the avahi Portfile, as explained in the ticket.
Update (2008-11-17): GnuCash does *not* compile on MacPorts at this moment, some dependencies do not work anymore, and there is a perl problem (it tries installing perl 2 times, once as perl5.8 and then once as perl5 on a clean MacPorts system)
---> Activating perl5 5.8.8_0+darwin_9 Error: Target org.macports.activate returned: Image error: /opt/local/bin/a2p is being used by the active perl5.8 port. Please deactivate this port first, or use the -f flag to force the activation.
Update (2008-12-28): The perl problem described above has been resolved. Gnucash 2.2.8 should build cleanly. Though it compiles you may still run into some launchd issue, see Ticket 17950.
Note (2006-11-15): If you receive an error about activating XFree86 that reads something like: "Target com.apple.activate returned: Image /usr/X11R6/lib/libXpm.4.11.dylib already exists and does not belong to a registered port. Unable to activate port XFree86." this means that you have MacOS-X X11User.pkg installed but noProxy-Connection: keep-alive Cache-Control: max-age=0
the X11SDK.pkg. You should install the X11SDK.pkg from the XCode Packages directory and then you can re-issue the "port" command.
Note (2007-03-21): When I used the above command it got part way through and then failed with the error message: *** LibOFX>=0.8.0 is required for backend "aqofxconnect". To get around this problem I simply installed libofx manually first with:
$ sudo port install libofx
and then retyped sudo port install gnucash and things proceeded smoothly.
MacPorts has updated its guile port to 1.8.1. While this is certainly nice, guile 1.8.1 does not work with GnuCash out-of-the box. :-(
If you have installed GnuCash using MacPorts before March 29, 2007, and want to upgrade to a more recent version, you will have to do the following:
sudo port uninstall gnucash sudo port -f uninstall g-wrap sudo port -f uninstall slib-guile sudo port -f uninstall guile sudo port clean g-wrap16 slib-guile16 guile16 # if you've already tried things on your own sudo port selfupdate sudo port install gnucash
These commands will remove those guile-related ports that now refer to guile 1.8.1 from your system. sudo port selfupdate retrieves current building instructions from the MacPorts server. sudo port install gnucash will then pull in guile16, slib-guile16 and so on, thus referring to known-good software versions.
If your original install of GnuCash using MacPorts was sometime after March 28, 2007, things should Just Work (tm), and you can ignore this section. :-)
Current developer version
MacPorts has a port to install a now quite out-of-date current developer version from the source code repository. So the current recommendation is to stick with the release port described above. The rest of this section is kept for historical reference.
If you've already installed the regular gnucash port, you will have to deactivate it:
sudo port deactivate gnucash
Then use the following command:
sudo port install gnucash-devel
For the 2.1.5 release (July 2, 2007), one needs to do the following after installing gnucash-devel:
sudo port uninstall gnucash-devel sudo port -f uninstall slib-guile sudo port -f uninstall guile sudo port clean slib-guile guile # for good measure sudo port -f install guile16 sudo port -f install slib-guile16 sudo port -f install gnucash-devel
Compiling on your own
If you want to run a more recent version of GnuCash 2 than that found in either of the above options, you can use the following instructions. Note however that at least in the spring of 2007, the gnucash-devel port has been tracking GnuCash unstable releases (and sometimes Subversion head versions) quite closely, so be sure that gnucash-devel is not recent enough for your needs. As before, make sure you have the latest version of XCode from Apple before you start.
According to the gnucash website "to install GnuCash, users will need Gnome 2, guile, slib and g-wrap" so the first steps (assuming MacPorts is installed) are simply:
$ sudo port install gnome $ sudo port install slib-guile16 $ sudo port install g-wrap16
Note that as of GnuCash-2.1.0, swig is used instead of g-wrap, so installing the g-wrap16 port is no longer necessary for this version and later.
Note that gnome will not build with +quartz or +no_x11 variants.
Expect gnome to take a long time, the other two should be done relatively quickly. After installing you should see the dependencies listed as active by using this command:
$ port installed
Libraries and Includes
Now, this author didn't find the following in the MacPorts documentation, if it is there please update this information. Make sure the MacPorts libraries are available to your compiler, change these appropriately for your shell
export CPPFLAGS="-I/opt/local/include" export LDFLAGS="-L/opt/local/lib" export DYLD_LIBRARY_PATH="/opt/local/lib"
Note: if you experience the following error
checking pkg-config is at least version 0.16... dyld: Symbol not found: __cg_jpeg_resync_to_restart Referenced from: /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/ImageIO Expected in: /opt/local/lib/libJPEG.dylib in /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/ImageIO ./configure: line 18613: 25817 Trace/BPT trap: 5 $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version
Try replacing the 3rd export above with
See this thread for more info.
Note: If you have multiple instances of macports installed, you may have to add the following lines:
export PKG_CONFIG_PATH="/<macport_path>/lib/pkgconfig:/<macport_path>/share/pkgconfig:$PKG_CONFIG_PATH" export PKG_CONFIG="/<macport_path>/bin/pkg-config" export PATH="/<macport_path>/apache2/bin:/<macport_path>/bin:/<macport_path>/sbin:/<macport_path>/lib/qt3/bin:$PATH"
Download the gnucash-2.x.x source, extract it, read the INSTALL file. You may want to adjust the configure line to suite your preferences. This author uses the following:
$ ./configure -C --prefix=/opt/local $ make $ sudo make install
If configure fails due to missing libraries then first make sure you properly set the CFLAGS, CPPFLAGS and LDFLAGS variables, and then verify that you actually installed the libraries.
Problems on Panther
libgnomecups is broken on Panther which precludes gnome from building (Panther has an older version of CUPS which doesn't have cupsGetFd). Fink (which has a different tree for Panther) takes care of this by using a older version of libgnomecups.