Alpine on MacOS

MacOS is a rather modern and highly GUI version of UNIX, so who would want to run an old-fashioned text mode only email client on it? Who knows, but one can. And not only is it possible, but it is fairly easy to built it from sources, rather than relying on Macports or some binary distribution. Instructions below:

(All the below instructions are to be typed in a terminal window. They install alpine in one's home directory, rather than in any system directories. Precise version numbers (1.0.2o and 2.21) will surely need changing -- they were correct in June 2018.)

1/ Make sure that a sufficiency of Xcode is installed.

  xcode-select --install

2/ Download the latest version of OpenSSL 1.0.2 from

  curl -O

3/ Extract archive

  tar -xf openssl-1.0.2o.tar.gz
  cd openssl-1.0.2o

4/ Be amazed that the default is to build 32-bit libraries, and one needs to specify a 64-bit build explicitly.

  ./Configure --prefix=$HOME darwin64-x86_64-cc

4a/ Be prudent, even though it is the longest part.

  make tests

5/ Install OpenSSL into one's home directory

  make install
  cd ..

6/ Download the alpine source code from its distribution site.

  curl -O

7/ Extract archive

  tar -xf alpine-2.21.tar.xz
  cd alpine-2.21

7a/ Regression in alpine 2.21: if you are using alpine 2.21 with an IMAP server, you may well wish to fix a significant performance regression introduced in this version (and which will be fixed in 2.22). In the file
at about line 4125 check for the following sequence:

    else if (!compare_cstring (t,"\\Unmarked")) i |= LATT_UNMARKED;
    else if (!compare_cstring (t,"\\HasChildren")) i |= LATT_HASCHILDREN;
    else if (!compare_cstring (t,"\\HasNoChildren")) i |= LATT_HASNOCHILDREN;
    else if (!compare_cstring (t,"\\All")) i |= LATT_ALL;
    else if (!compare_cstring (t,"\\Archive")) i |= LATT_ARCHIVE;

Note the "NoChildren" line, and add it if absent.

8/ Configure. Omit the --without-ipv6 if you want IP v6 support, or keep it if you believe that IP v6 currently causes more issues than it solves!

  ./configure --prefix=$HOME --with-ssl-dir=$HOME --without-ipv6

9/ Build and install.

  make install

This should leave alpine correctly installed in ~/bin. Unusually for a UNIX, MacOS does not place this directory on the default searchpath for executables. This can be solved by adding the line:


to a file called ~/.bash_profile (if no file of that name exists, then create it with just the above contents, which typing

  echo 'PATH=${HOME}/bin:${PATH}' >> ~/.bash_profile

will do. At this point it ought to be possible to start a new Terminal window, type alpine, and enjoy the usual features of alpine. URLs will be correctly passed to one's default web browser, and other external viewers should function correctly.