Installing Python and Mailman on Mac OS X Server
Updated 12 September 2002
![]() |
PythonMuch to our surprise (and pleasure), Apple has included Python 2.2 in Mac OS X Server 10.2. Mailman 2.0.x will run quite happily in that environment. |
![]() |
Mailman 2.0.13The Mailman 2.0.13 software itself compiles cleanly under Mac OS X 10.2, but there is a critical caveat you need to take into consideration before making a new installation. Under Jaguar Server, the Workgroup Manager application is used to create new users. Workgroup Manager does not create home directories! Once you have created the user and group entries for Mailman, you will need to create the actual /Users/mailman directory yourself before attempting to install the software. |
NOTE: Apple ships Mac OS X Server 10.3 with Mailman 2.1.2; do not follow these directions if you use Mac OS X Server 10.3!
Mailman is a powerful e-mail list server that can manage hundreds of lists with tens of thousands of subscribers. It uses both a Web and e-mail interface for configuration and list management. Mailman is written largely in a language called Python; in order to use Mailman, you must have a recent version of Python installed. Mac OS X does not come with Python, so we will need to obtain and install it.
Installing Mailman is a fairly complex process. You will need to have root access in order to complete installation and configuration. In order to install Mailman, you will need to create a new user (Mailman) and group (mailman). While it’s reasonably easy to do so using the Server Admin tool, these instructions are oriented toward complete use of the command line. You can still use Server Admin, of course, but it can’t hurt to become a little acquainted with NetInfo’s command line interface as well.
It is useful to point out that the Mailman team are working on a new version, Mailman 2.1, which should offer major improvements in several areas. These instructions are intended for Mailman 2.0.8 (the current, stable release as of February 2002) and may not work with Mailman 2.1 at all. When the new version is released and tested, I’ll update this article to reflect the new release.
Also, these instructions assume that you have installed and are using Postfix as your mail transport agent. You will need to disable Apple Mail Service for mail delivery, as well, in order to use Mailman. See this article for instructions on how to do that.
Conventions used in this document:
- $HOME
-
Your home directory, which is normally /Users/your-short-name; for example, if your 'short name' login is 'jdoe' your home directory will be /Users/jdoe.
- $TEXT
-
Replace '$TEXT' with whatever 'TEXT' requests. For example, $YOURADDRESS would be replaced with your e-mail address. Explanations of what is wanted are usually included in subsequent Note text.
- text like this
-
This text represents command line text—commands you should enter, or the names of important files.
- Login to an account with administrator access.
- Create a directory in which to store source files, such as $HOME/src.
- Change to your source files directory.
- Obtain the latest stable source for Mailman (currently Mailman 2.0.8) from ftp.gnu.org/mailman/. The latest build is mailman-2.0.8.tgz.
- Obtain the source for a version of Python. Mailman will run on Python 1.5.2, but the latest stable version is Python 2.2. The latest version will install on Mac OS X, so grab it as ftp.python.org/pub/python/2.2/Python-2.2.tgz.
Note: a different developer has made available a version of Python for Mac OS, but this is not the same as the Unix-style Python we obtained from the python.org site. You cannot run Mailman using the non-Unix Python. - gunzip and tar xvf the Python-2.2.tgz tarball; gunzip the mailman-2.0.8.tgz tarball.
- Check to see if /usr/local/lib exists; if not, gain super-user rights and create it.
- Change to the Python-2.2/ directory.
- Execute the ./configure script.
Note: As the configuration proceeds, you may notice that the script is unable to determine the canonical hostname for your machine. This is due to the lack of reverse DNS for it. If so, you will need to explicitly provide the machine’s hostname (obtained from echo $host) later. - Once configuration is complete, run make.
- Execute the command limit stacksize 2048 and then run make test.
Note: this step will take a fair amount of time to complete. The test may fail for several libraries, but none of them are critical to Mailman. - Execute make install.
- Relinquish super-user rights and execute the rehash command.
- Check whether Python built correctly by executing the python command. You should see output similar to the following:
Python 2.2 (#1, Jan 28 2002, 12:44:23)
[GCC 2.95.2 19991024 (release)] on darwin
Type “help,” “copyright,” “credits” or “license” for more information. - As super-user, create the “mailman” user:
- niutil -create / /users/mailman
- niutil -createprop / /users/mailman name mailman
- niutil -createprop / /users/mailman realname Mailman
Note: Strictly speaking this isn’t necessary, but Server Admin gets fussy if it sees users without 'realname' properties. - niutil -createprop / /users/mailman uid 5990
Note: I’ve supplied user ID 5990, but you should use an ID value that is not already taken on your machine. - niutil -createprop / /users/mailman home /Users/mailman
- niutil -createprop / /users/mailman shell /bin/tcsh
- passwd mailman
- Create the “mailman” group and populate it with the “mailman” user:
- niutil -create / /groups/mailman
- niutil -createprop / /groups/mailman name mailman
- niutil -createprop / /groups/mailman gid 5990
Note: I’ve supplied group ID 5990, but you should use an ID value that is not already taken on your machine. - niutil -createprop / /groups/mailman passwd '*'
- niutil -createprop / /groups/mailman users 'mailman'
- Create Mailman’s home directory:
- mkdir /Users/mailman
- chown mailman:mailman /Users/mailman
- Change to Mailman’s home directory.
- Relinquish super-user rights.
- Change to the Mailman user: su - mailman
- Copy the mailman-2.0.8.tar file to Mailman’s home and run tar xvf against it.
- Execute the chmod a+rx,g+ws . command from within Mailman’s home directory.
Note: The chmod command ends in a period. - Change to the mailman-2.0.8/ directory.
- Configure the mailman installer: ./configure --prefix=/Users/mailman --with-mail-gid=-2 --with-cgi-gid=www
- As super-user, execute the make install command.
Note: Technically, we should do also this as Mailman; however, because the mailman account doesn’t have setgid rights, we need to execute it as root. We’ll come back and clean up the ownerships after make install has completed. - Still as super-user, change to Mailman"s home directory and recursively set the ownership of all enclosed files to the mailman user: chown -R mailman:mailman *
Note: You could also use chown -R mailman:mailman Mailman/ archives/ bin/ cgi-bin/ cron/ data/ filters/ icons/ lists/ locks/ logs/ mail/ qfiles/ scripts/ spam/ templates/ - Execute bin/check_perms
- If any errors are reported, execute bin/check_perms -f repeatedly until no errors remain.
- Change to the /etc/httpd/ directory and open httpd.conf in a command-line editor (emacs, vi, etc.)
- Find the section where ScriptAliases are setup, and add the following line:
ScriptAlias /mailman/ “/Users/mailman/cgi-bin/" - Find the section where Aliases are setup, and add the following line:
Alias /pipermail/ “/Users/mailman/archives/public/" - Copy the following files in /Users/mailman/icons/ to /usr/share/httpd/icons/:
- mailman.jpg
- PythonPowered.png
- gnu-head-tiny.gif
- Relinquish super-user rights and change to the mailman user.
- Change to the cron/ directory and execute the command crontab crontab.in
- Change to the Mailman directory (cd ../Mailman)
- As super-user, open the mm_cfg.py file using a command-line editor (emacs, vi, etc.)
- Add the following lines to the end of the file:
- MTA = 'Postfix'
- IMAGE_LOGOS = '/icons/'
- DEFAULT_HOST_NAME = 'your-hostname'
Note: replace your-hostname with the output of echo $host, if you lack reverse DNS. - DEFAULT_URL = 'http://your-hostname/mailman/'
Note: This like is necessary if you have no reverse DNS for your server, or if you run virtual domains and don’t want Mailman answering to your default domain.
- As super-user, change to the /etc/postfix/ directory.
- Add the following lines to the aliases file:
- mailman:<TAB>$YOURADDRESS
- mailman-owner:<TAB>mailman
Note: '<TAB>' indicates you should press the tab key. '$YOURADDRESS' should be replaced with the e-mail address of whomever will manage the Mailman server. - Execute the newaliases and postfix reload commands.
- Relinquish super-user rights.
- Change to the Mailman user: su - mailman
- Execute the bin/mmsite_pass $SITEPASSWORD command.
Note: '$SITEPASSWORD' should be whatever you want the super-administrator password to be. This password will let the administrator effect changes to any list, regardless of that list’s administrative password. - Create a test list with the command bin/newlist, and answer the prompts with the appropriate information.
- Copy the alias file output of the newlist command to the clipboard.
- Change to the /Users/mailman/data/ directory.
- Append the contents of the clipboard to the aliases file.
- As super-user, execute the postalias aliases command.
- As super-user, change to the /etc/postfix/ directory.
- Using a command-line editor (emacs, vi, etc.), edit the main.cf file.
- Find the alias_maps line.
- Append a comma to the end of the line, followed by a space and the text hash:/Users/mailman/data/aliases
Note: if necessary, the hash:/Users/mailman/data/aliases text can appear on a line by itself, so long as the text is preceded by whitespace. - Execute the postfix reload command.
Mailman is now installed and configured on your server.
To view the lists that are publicly accessible, point a web browser at http://$YOURDOMAIN/mailman/listinfo ($YOURDOMAIN should be whatever you configured Mailman to use as the base for its web pages, in step 37) and click on the appropriate list.
To create a new mailing list, you must log in to the server and, as user mailman, execute the command bin/newlist from within Mailman"s home directory (/Users/mailman/). Follow the directions on the screen, remembering to execute the postalias aliases and postfix reload commands as super-user after you add the list aliases.
Once the new list has been created, point a web browser at http://$YOURDOMAIN/mailman/admin/$LISTNAME and supply the administrative password to begin modifying it.
To add new subscribers, click on the 'Membership Management' link. Enter the addresses of the new subscribers in the 'Mass Subscribe' input field, one per line. This method is useful for small numbers of additions. For greater numbers, load the names to be added into a text file, one e-mail address per line. Save the file with UNIX line-ends and transfer it to the mail server. Use the command
bin/add_members -n $FILESPEC -c n -w n $LISTNAME
where $FILESPEC is the full pathname of the file (e.g., /Users/david/biglist) and $LISTNAME is the name of the list (which must already exist).
Prospective list members can also go to http://$YOURDOMAIN/mailman/listinfo/$LISTNAME to subscribe to the list via the Web interface.
Mailman was designed from the ground up to be a secure mail list server, and as such each list member has a password that is used to change list settings, view archives and unsubscribe. If a list member subscribes using the Web interface, she must choose a password at that time. When mass-subscribing members, you can elect to have each list member receive a randomly-generated password then, or wait until such time as the list members needs the password—if you choose the latter path, they can retrieve the randomly-generated password from the Web interface and set it to a password of their choosing. The bin/add_members command outlined above takes that path.
List members can use e-mail to control their subscriptions; they should send commands to $LISTNAME-request@$YOURDOMAIN to have the server execute them. Commands can be in the Subject header or message body. The commands they can use are outlined below.
|
Command |
Action |
|
help |
Replies with a message outlining the commands available |
|
subscribe $LISTNAME $OPTIONAL-PASSWORD |
Join the list $LISTNAME, and optionally set their list password (otherwise, the server generates one randomly) |
|
unsubscribe $LISTNAME $PASSWORD |
Leave the list $LISTNAME. The member"s password must be included in this command. |
|
who |
See all of the other members on the list (assuming the list hasn"t been configured to prevent it) |
|
info |
See any introductory text the list owner has prepared. |
|
lists |
See the names of any publicly-accessible lists on this server |
|
set $OPTION on|off |
Enable or disable any of the following list options:
|
|
options |
See your current list options |
|
password $OLDPASSWORD $NEWPASSWORD |
Change your list password |
Members should use the “end” command after list commands in the message body, to prevent the server from trying to interpret any signature block they might use.
