How to install POVScript+ (MOLScript) on macOS

When I was working on my MSc thesis—on a subject involving a lot of protein science—I wanted to be able to generate my own protein structure models from PDB format files that are available from the Protein Databank Archive. However I quickly discovered that the more capable programs either require users (even students) to purchase a license, or that most of the freely available programs are incapable of generating scalable, publication quality graphics.

During my searches I found two programs that I believed would be able to produce the high-quality images I wanted: CCP4 and POVScript+. Both programs are free to use, but whereas CCP4MG is available as a precompiled binary for macOS, POVScript+ is not. That means that you must build the POVScript+ tools from scratch. This is certainly not a trivial task for the casual computer user. But even users familiar with more hands-on operating systems—like Slackware Linux, or FreeBSD—may also encounter minor frustrating issues. So here I will explain how I got it all to work. I assume you have a basic understanding of the UNIX file structure, and that you understand at least the basics of using a terminal program to enter commands.

The first requirement is that you will need to have installed Xcode from Apple. This is a so-called SDK (Software Development Kit), and it is free to download from Apple’s website. [UPDATE: You can also install just the XCode “Command Line Tools” package, which will take up a lot less space on the hard drive.] Make sure that you have enough free space on your system, because it takes up over 10 Gigabytes after installation. And it is also worth mentioning that if you just installed Xcode—and thus have never used it—that you will not be able to compile anything at all. Try anyway and all you’ll get is an error message saying that the C compiler doesn’t work. Even though it’s brand new.

First run “sudo xcodebuild -license” and accept the damn license, then you’re good to go.

But the compiler works just fine of course. What that confusing error message is actually trying to communicate is that you first have to accept the license agreement from Apple before you can use Xcode. So all you do is first run gcc by itself and then Xcode will tell you what you need to do.

You want to be agreeable here.

Next you will need the GNOME libraries (called GLIB). Simply follow these instructions. First copy the shell script to wherever you want to build GLIB (using the “Save link as…” option) and then open a terminal, cd into that directory, and execute the script using the command “sh” (keep in mind that if you try executing the script directly with the command “./“, that you may first have to make the script executable by using the command “chmod u+x“). Then continue with jhbuild as instructed.  It should start building everything automagically, though it may take a while for it to finish since it’s a relatively big build. It might be a good time to have a long coffee break.

Once GLIB is done, the other thing we need to have is the GTS Library. First download the source files here. Then execute the configure script, substituting  the “/path/to/gtk” bit with the actual location of your gtk directory: “./configure –with-glib-prefix=/path/to/gtk/inst/lib PKG_CONFIG=/path/to/gtk/inst/bin/pkg-config“. Then run “make” followed by “make install“. Done. On to the final step.

Finally we have arrived at the last step, where we start building POVScript. First download the sources here, and after unpacking you change directory into the newly created povscript directory and execute “./configure –with-gif=no –with-jpeg-lib=/path/to/gtk/inst/lib –with-png=no –with-jpeg-inc=/path/to/gtk/inst/include“. Again you must substitute all paths with ones that are correct for your system. If this goes well, just execute “make” to build POVScript. Running “make install” doesn’t seem to work (at least on my system), so instead I just create two symbolic links in /usr/local/bin that point to the binaries molauto and molscript that are located in the /src subdirectory.

So now if you download protein 5EC5.PDB (in pdb format) from the Protein Databank Archive, you can use the following command “molauto /path/to/5ec5.pdb | molscript -ps -out /path/to/” to create something awesome like this:


Hopefully you should now be able to create similar models. If you managed to get POVScript+ working, then you can finalize by deleting some stuff you don’t need. And there is a lot of stuff you don’t need! The whole GTS Library build directory with sources can be trashed since you already installed the libs on your system. And from the gtk directory (containing over 2 gigabytes of data!) you only need the subdirectory “.../gtk/inst“.  Once you delete the source files, you will have reclaimed about 1.8 gigabytes of valuable memory space. And finally you can also delete Xcode—unless you plan to build more projects, of course.

Wageningen University: sending email using msmtp

I have recently posted a pdf explaining how to configure Mutt if you are a student or employee at Wageningen University and wish to use your WURnet email account on your own computer. In that HOWTO the program used to send mail (msmtp) is configured to use DavMail instead of directly connecting to the universities SMTP server. For those of you who do want to connect directly instead, the following lines may be used in “~/.msmtprc”.

# Configuration for direct connection (no DavMail needed)
account WUR
port 25
from <>
tls on
tls_trust_file /usr/local/share/certs/ca-root-nss.crt
tls_starttls on
auth on
user <>
password <your WURnet password>

This configuration will work on FreeBSD, where the ca-certificates are found in the location /usr/local/share/certs. If you use a different system, then you may need to specify a different directory. Alternatively, it would also be possible (with decreasing security) to use (a) the tls_fingerprint option or (b) the tls_certcheck option (see “man msmtp”). For the tls_fingerprint option, you will need to specify the SHA1 fingerprint of the certificate that the server uses, which you can find by executing e.g.:

$> msmtp –serverinfo –tls –tls-certcheck=off – | grep SHA | sed -r ‘s/.{14}//’

If this also doesn’t work (and it really should!), then you could also just use “tls_certcheck no”. But this can leave your email vulnerable to MitM’ing unpleasantness, so it is best avoided.

Deleting files more securely in FreeBSD

People use computers to create and store bodies of text, in some format or another, that may contain private information. When these files are not encrypted—an all too common situation—then they can in theory be read by anyone with physical access to the storage medium upon which these files are encoded. But even worse, your files can be read even after you have deleted them.

That is because, simply put, when you instruct your system to delete a file (e.g. by executing “rm /path/to/file.txt”) it doesn’t really “delete” anything, it just makes the address unavailable to the system. Or, to use an analogy, the operating system is like a person who has forgotten where his diary is located. But the diary is still somewhere in his house, and anyone who can physically enter the house and searches thoroughly just might be able to find it. This may not be what you want.

So if you truly want no-one to be able to read your personal diary, then doing so by simply forgetting where you keep the diary makes no more sense in the binary world than it does in the physical universe. Instead, you want to take a big black marker pen and vigorously cross out every page of writing in the diary, preferably a couple of times just to be sure you didn’t miss anything. Something similar can be done to files on your FreeBSD system as well.

In order to securely delete files, you will first need to install the GNU coreutils in /usr/ports/sysutils/:

root@hostname:~ # cd /usr/ports/sysutils/coreutils/
root@hostname:/usr/ports/sysutils/coreutils # make install clean

This will install the GNU shred command, which will be called “gshred” on FreeBSD systems. Using this command, you can safely delete files containing sensitive data. For example, say you want to delete the file “private.txt” in your home directory. Then you would execute something like this:

[user@hostname ~]$ gshred -vuz private.txt

See also “man gshred” for more info.