How to Edit Text Configuration Files on OS X Server

Managing OS X Server, quite often requires one to manually edit text based configuration files. As do many of our tutorials and FAQs.

There are many ways of doing this. You can use a Terminal based editor or one with a fancy GUI. What is paramount though, is that you use a Plain Text Editor like TextWrangler, Textastic or BBEdit. Rich Text Editors like Microsoft Word or Pages can severely damage your configuration files. Keeping above in mind, the rest comes down to personal preference.

On OS X I prefer to either use PICO, a Terminal based editor or TextWrangler which has a simple but powerful GUI and good syntax highlighting.

On iOS, PICO – accessed through an SSH session with Prompt – or TextWrangler with its built in SFTP client are my tools of choice.

Whether I use a Terminal based editor or one with a GUI mainly depends on the task at hand. For quick edits of a few lines, PICO works well and is the fastest way to go. If I need to make lots of changes or need a good overview of the file I am editing, a GUI editor is way more comfortable.

Let’s have a quick look at how these work.

Assuming we want to modify Postfix’, we would issue:

sudo pico /Library/Server/Mail/Config/postfix/

And be presented with a view like this:

Now we can use our cursor keys to move around, the backspace key to delete characters or simply type what we need. When we are done editing, we need to save and exit. The commands for this are at the bottom of the window.

In order to save and exit, we would hit CTRL-O (to write the file) and CTRL-X to exit PICO. Alternatively we can just hit CTRL-X and enter y when asked to save.

Have a good look at the available commands as there are more options like cutting text and page scrolling.

While it may need a bit of time to get adjusted to, mastering a Terminal based text editor can be a very useful item in your tool chest.

Using the GUI instead of Terminal

If you don’t like using Terminal, you can always use a Plain Text Editor like TextWrangler which would look something like this

and behave like any other GUI Plain Text Editor.
The choice is yours, just make sure you avoid Rich Text Editors like Microsoft Word or Pages. There are plenty to choose from, like TextWrangler, Textastic, BBEdit, SubEthaEdit, SublimeText and many more. The choice on iOS is equally large.

For this tutorial, let’s look at TextWrangler which is a powerful (yet free) plain text editor

TextWrangler allows you to navigate hidden directories (/etc /Library etc) and edit files even when they are owned by root.

IMPORTANT: Don’t use the App Store version
Due to app store rules, the version from the app store is not able to unlock/edit files.
Download the application directly from the publisher:

These steps walk you through editing a hidden/privileged (root) file. We’ll use /etc/php.ini as our example.

In TextWrangler, use the Open File by Name option in the File menu.
This allows you to simply paste the path/name: /etc/php.ini


Another way to open /etc/php.ini is with the more familiar Open Dialog from TextWrangler.
Be sure to choose the Show Hidden Files option.


ALWAYS backup a file before you make changes
Save a backup to your Desktop using the Save a Copy option from the File menu.
Because the file is owned by root, you’ll need to authenticate.

Screen Shot 2016-02-10 at 11.45.44 AM

We need to be careful editing this file, one out of place character could effect your system.
You did backup first, right ?

Let’s make a safe change.
In the php.ini file, comments start with a semi-colon.
Simply add a space at the end of one of the commented lines:

; About php.ini   ;  <<--- add a space at the end of this line

When you attempt to edit the file, you’ll be asked to authenticate again.
Once you authenticate, you can edit, then save the file.

That is all there is. Happy editing!

spamtrainer for Mac OS X 10.4-10.7

spamtrainer assists Mac OS X Server mail services administrators in updating and maintaining their SpamAssassin bayes database.

spamtrainer will read the designated HAM and SPAM mailboxes, update the SpamAssassin databases and delete mail that has been learned from.
It has an array of additional functions. Among them the possibility to backup/restore your bayes database and many more.
This script is written for Mac OS X 10.4.x, 10.5.x, 10.6.x, and 10.7.x, but it will work on Mac OS X 10.3.x with SpamAssassin as well. A separate release is available for later OS X versions.

See current changelog for a complete list of fixes and additions.
Please read our FAQs as well.

spamtrainer is a free download.

Download spamtrainer 1.9.9



The latest release of mailbfr is available for download on this page.

See current changelog for a complete list of fixes and additions.
Please read our FAQs as well.

mailbfr assists Mac OS X Server mail service administrators in creating a backup of their active mail settings and stores.

mailbfr will create a backup of all Postfix and Cyrus settings, together with the Postfix Queue, the Cyrus Mailstores and Sieve scripts. The type of backup (full, incremental, rotation) can be selected.

It has an array of additional functions. Among them the possibility to selectively restore settings, single mail stores, single mail users or all mail services.

mailbfr can also assist you in fixing a corrupt cyrus database.

This script is written for Mac OS X 10.3.x, 10.4.x and 10.5.x.


Download mailbfr 1.0.7
Get help for mailbfr


mailbfr Changelog

1.0.7 Release – 22.4.2010

-As of this release, mailbfr will fork into a Cyrus and a Dovecot branch
-Changes in update mechanism to accomodate future releases of separate branches

1.0.6 Release – 26.8.2009
-Minor bug fix and clean up
-This is the last release supporting Mac OS X Server 10.3 Panther

1.0.5 Release – 11.08.2009:
-Bug fix to correct start/stop behaviour in 10.3

1.0.4 Release – 27.07.2009:
-Minor bug fix that would prevent restore of mailman configuration files

1.0.3 Release – 3.06.2009:
-Minor bug fix

1.0.2 Release – 21.04.2009:
-Minor bug fix

1.0.1 Release – 20.04.2009:
-Added backup of mailman
-Changes in how mail services are stopped to avoid Server Admin bug
-Only IMAP services are stopped during backup/restore
-Structural changes to accommodate dovecot

0.9.5 Release – 26.08.2008:
-Added some warning strings
-Added option to purge a mailbox’ contents
-Added check to check for spaces in paths
-Removed restoration of settings in transfer mode
-Changed update URL

0.8.5 Release – 26.10.2007:
-Changed version display for 3rd party software
-Leopard compatibility
-New transfer option

0.7.3 Release – 17.4.2007:
-Added a check to see if the backup path/volume exists.

0.7.2 Release – 16.12.2006:
-Cosmetic changes

0.7.1 Release – 15.12.2006:
-Added time stamp to output at beginning and end of backup

0.7.0 Release – 11.12.2006:
-Added backup of custom spamassassin rules
-Added more configuration related error trapping
-Minor cosmetic fixes
-Increased verbosity of error messages
-Changed Postfix queue restore procedure

0.6.9 Release – 7.12.2006:
-Sieve issue on poorly configured systems fixed.

0.6.8 Release – 6.12.2006:
-Disabled copying of Sieve directory because of intermittent not reproducible errors on a handful of systems.

0.6.7 Release – 5.12.2006:
-Modified routine for stopping and starting services. Will not restart services if they were already stopped at runtime.
-Added fix for backing up with broken sieve folders

0.6.6 Release – 28.11.2006 :
-Modified routine for online updates to notify users if an update check is not possible.

0.6.4 Release – 22.11.2006 :
-Added version display for mail system components
-Added display of version number to progress output
-Added some additional error trapping

0.6.3 Release – 21.11.2006 :
-Minor bugfix

0.6.2 Release 17.11.2006:
-Minor bug fix

0.6.1 Release 17.11.2006:
-Added option for restoring single mailbox/user
-Added option for reconstructing single mailbox/user
-Added option for displaying usernames
-Added option for displaying detailed mailbox/user information
-Backup/Restore now includes sieve directory

0.5.1 Release 10.11.2006:
-Added choice for incremental or full backup
-Added simple weekly rotation mechanism
-Removed diagnostics
-mailbfr is now distributed as an installer package

0.4.7 Release:
-Fixed minor Bug for certain 10.3.x configurations

0.4.6 Release:
-Fixed error in man file

0.4.5 Release:
-Added a check for certain 10.3.x configurations

0.4.2 Release:
-Changed reconstruct routine to include partitions

0.4.1 Release:
-Added a diagnostics routine
-Added text to tell user to use 24-hour clock when adding cronjob

0.3.9 Release:
-Added a configuration check for illegal directory settings

0.3.6 Release:
-Changed all copy processes to rsync
-Changed chown to /usr/sbin/chown for cron
-Minor cosmetic fixes

0.3.4 Release:
-Excluded “socket” and “pid” directories from backup
-Added chown/chmod to backup directory
-Check for mail service status before starting on error

0.3.1 Release:
-Streamlined automatic update feature

0.3.0 Release:
-Added automatic update feature
-Cron friendly

0.2.1 Release:
-Fixed problem when backing up partitions

0.2.0 Release:
-First Public Release

You can download the latest release of mailbfr from our downloads page