Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Is /usr/bin/mail a link to sendmail/postfix

407 views
Skip to first unread message

Robert Chalmers

unread,
Mar 12, 2016, 10:55:49 AM3/12/16
to
I have /usr/bin/mail on the mac, and it’s looking for /etc/postfix/main.cf 

I have rebuilt postfix from source, and relocated it, the files now living in /usr/local/etc/postfix 


So I’m wondering what /usr/bin/mail’s relationship to postfix is?


Robert Chalmers




Robert Wolfe

unread,
Mar 12, 2016, 11:28:52 AM3/12/16
to
It might be trying to use postfix as the MTA.

/dev/rob0

unread,
Mar 12, 2016, 2:09:17 PM3/12/16
to
On Sat, Mar 12, 2016 at 03:55:10PM +0000, Robert Chalmers wrote:
> I have /usr/bin/mail on the mac, and it’s looking for
> /etc/postfix/main.cf

It's not a part of Postfix at all. Mailx/mail is a MUA, whereas
sendmail(1) is a Postfix to Sendmail compatibility interface. Most
mailx implementations invoke sendmail to send mail.

> I have rebuilt postfix from source, and relocated it, the files now
> living in /usr/local/etc/postfix

You're probably seeing that error when mail runs the sendmail
command, which is the one which came with your OS. Did you remove
the OS package of Postfix before proceeding? Even so, you might need
symbolic links to keep other software (which runs sendmail) happy.

> So I’m wondering what /usr/bin/mail’s relationship to postfix is?

Consult the documentation for your mailx implementation to find where
it looks for the sendmail binary.
--
http://rob0.nodns4.us/
Offlist GMX mail is seen only if "/dev/rob0" is in the Subject:

Wietse Venema

unread,
Mar 12, 2016, 4:02:54 PM3/12/16
to
Robert Chalmers:
> I have /usr/bin/mail on the mac, and it?s looking for /etc/postfix/main.cf
>
> I have rebuilt postfix from source, and relocated it, the files now living in /usr/local/etc/postfix
>
>
> So I?m wondering what /usr/bin/mail?s relationship to postfix is?

/usr/bin/mail sends mail through /usr/sbin/sendmail which is normally a part of Postfix
or a symlink to a part of Postfix.

Wietse

Chalmers

unread,
Mar 12, 2016, 4:15:46 PM3/12/16
to
Thanks.
So on OSX 10.11 mail is hard coded to look for /etc/postfix/main.conf.
A bit of a nuisance. So I'll just symlink to my /usr/local/etc/postfix/main.conf



-----
From my iPhone.

Viktor Dukhovni

unread,
Mar 12, 2016, 4:40:31 PM3/12/16
to
On Sat, Mar 12, 2016 at 09:15:11PM +0000, Chalmers wrote:

> So on OSX 10.11 mail is hard coded to look for /etc/postfix/main.conf.

No, not all. Rather, the standard local submission interface on
Unix systems has been sendmail(1) for over 3 decades. The only
thing that's changed is the location from /usr/lib/sendmail to
/usr/sbin/sendmail on most systems.

With MacOS/X, /usr/sbin/sendmail is not surprisingly part of the
base-system Postfix. On my 10.11.3 system:

$ strings /usr/sbin/sendmail | egrep mail_version=
mail_version=2.11.0

> A bit of a nuisance. So I'll just symlink to my /usr/local/etc/postfix/main.conf

The symlink may not be wise. The system Postfix may then attempt
to use the same queue directory as your non-system Postfix.

You might get away with updating the command_directory in
/etc/postfix/main.cf:

command_directory = /usr/local/sbin

Then the system sendmail(1) command will invoke your non-system postdrop(1)
to queue the mail.

A more robust solution is to configure the system Postfix as a
null-client (SMTP forward to localhost:26 or some other port !=
25) of the non-system Postfix.

--
Viktor.

rob...@chalmers.com.au

unread,
Mar 13, 2016, 3:58:54 AM3/13/16
to
Let me explain what's happening, or what happened.

I rebuilt Postfix, to install in /user/local/etc/postfix and set the command to be in /user/local/sbin and so on, and it all works fine, as it should.
The reason I moved it, is because each time OSX updates, it overwrites /etc/postfix of course, and the OSX build doesn't do what I want postfix to do.
Also, I find myself modifying /etc/postfix *.cf files, because I forget that I've moved the active version.

So I renamed/moved /etc/postfix, to /etc/old-postfix. .which has been ok, except for 'mail'
Eg
echo date | mail rob...@chalmers.com
Fails with
'can't find /etc/postfix/main.cf'

It's the only thing that fails. I move old-postfix back to etc/postfix, and of course it works again.
I need 'mail' to work, because it is used by crown if nothing else...

So that's what made me wonder if it's related to postfix in some way, as it seems to need it.

Robert






Sent from my iPad

Alice Wonder

unread,
Mar 13, 2016, 4:41:35 AM3/13/16
to
On 03/12/2016 11:58 PM, rob...@chalmers.com.au wrote:
> Let me explain what's happening, or what happened.
>
> I rebuilt Postfix, to install in /user/local/etc/postfix and set the command to be in /user/local/sbin and so on, and it all works fine, as it should.
> The reason I moved it, is because each time OSX updates, it overwrites /etc/postfix of course, and the OSX build doesn't do what I want postfix to do.
> Also, I find myself modifying /etc/postfix *.cf files, because I forget that I've moved the active version.
>
> So I renamed/moved /etc/postfix, to /etc/old-postfix. .which has been ok, except for 'mail'
> Eg
> echo date | mail rob...@chalmers.com
> Fails with
> 'can't find /etc/postfix/main.cf'
>
> It's the only thing that fails. I move old-postfix back to etc/postfix, and of course it works again.
> I need 'mail' to work, because it is used by crown if nothing else...
>
> So that's what made me wonder if it's related to postfix in some way, as it seems to need it.
>
> Robert

Not sure about OS X but on Linux the mail command uses /sbin/sendmail
which is provided by postfix.

It's possible the mail command on OS X is using the OS X sendmail
command provided by the OS X postfix which would want its configuration
file at /etc/postfix/main.cf

You may need to move the OS X sendmail command and make a symlink from
/usr/local/sbin/sendmail (as provided by postfix built from source) to
/sbin/sendmail (or wherever OS X keeps it) so that the right sendmail
command is available to OS X mail command.

Jim Reid

unread,
Mar 13, 2016, 6:08:03 AM3/13/16
to

> On 13 Mar 2016, at 08:41, Alice Wonder <al...@domblogger.net> wrote:
>
> It's possible the mail command on OS X is using the OS X sendmail command provided by the OS X postfix which would want its configuration file at /etc/postfix/main.cf

It is. Though MacOSX puts the sendmail front-end in /usr/sbin:
% strings /usr/bin/mail | grep /
...
/usr/sbin/sendmail
...

> You may need to move the OS X sendmail command and make a symlink from /usr/local/sbin/sendmail (as provided by postfix built from source) to /sbin/sendmail (or wherever OS X keeps it) so that the right sendmail command is available to OS X mail command.

Easier said than done. MacOSX 10.11 introduced System Integrity Protection. This means most, if not all, of the OS cannot be modified by anything unless the OS is booted in recovery mode and csrutil is used to disable or enable SIP. [Which probably explains why the Macs now boot twice during an upgrade: once in recovery mode to make the changes and then another to resume “normal” operations.] By default the SIP-protected directories and files include everything in /usr except /usr/local.

The path of least resistance would be to put the postfix config files in /etc/postfix where the Apple-supplied postfix tools expect to find them. Be sure to keep copies of these files elsewhere in case Apple stamps all over them at the next OS upgrade. Messing around with SIP settings or being clever with symbolic links is likely to end in pain, particularly when the next upgrade comes along.

Wietse Venema

unread,
Mar 13, 2016, 10:53:42 AM3/13/16
to
rob...@chalmers.com.au:
> It's the only thing that fails. I move old-postfix back to
> etc/postfix, and of course it works again. I need 'mail' to work,
> because it is used by crown if nothing else...
>
> So that's what made me wonder if it's related to postfix in some
> way, as it seems to need it.

According to the MacOS mail(1) manpage, there is a central configuration
file /etc/mail.rc

Try appending a line with "set sendmail /usr/local/sbin/sendmail"
to that file.

Wietse

Robert Chalmers

unread,
Mar 13, 2016, 11:06:41 AM3/13/16
to
I’d forgotten about strings - getting old.
That fixed the problem. I 
moved /etc/postfix to /etc/x-postfix
linked -s /usr/local/sbin/sendmail to /usr/sbin/sendmail

did 
echo date | mail rob...@chalmers.com

and it works.

 I disabled SIP as soon as I installed the upgrade ages ago.

and I confess I’m amazed at Apple. Nice hardware, but the software is really recycled FreeBSD. say what?
Check the result of strings… on mail at least. I thought it was familiar - One of the systems I  learnt Unix on was FreeBSD… very cheeky. So all I need - if I’m bothered, is the source of FreeBSD’s mail, and rebuild it myself so it links to postfix’s sendmail where I want it properly. But then of course the next upgrade will trash it again anyway - same as it will with my symlink to /usr/local/sbin/sendmail…. oh well. Can’t win.

zeus:~ robert$ strings /usr/bin/mail | grep /
$FreeBSD: src/usr.bin/mail/aux.c,v 1.13 2002/08/25 13:22:47 charnier Exp $
$FreeBSD: src/usr.bin/mail/cmd1.c,v 1.7 2002/06/30 05:25:05 obrien Exp $
$FreeBSD: src/usr.bin/mail/cmd2.c,v 1.9 2002/06/30 05:25:06 obrien Exp $
$FreeBSD: src/usr.bin/mail/cmd3.c,v 1.10 2002/06/30 05:25:06 obrien Exp $
$FreeBSD: src/usr.bin/mail/cmdtab.c,v 1.6 2002/06/30 05:25:06 obrien Exp $
$FreeBSD: src/usr.bin/mail/collect.c,v 1.12 2002/06/30 05:25:06 obrien Exp $
$FreeBSD: src/usr.bin/mail/edit.c,v 1.9 2002/06/30 05:25:06 obrien Exp $
$FreeBSD: src/usr.bin/mail/fio.c,v 1.12 2002/06/30 05:25:06 obrien Exp $
$FreeBSD: src/usr.bin/mail/getname.c,v 1.4 2002/06/30 05:25:06 obrien Exp $
$FreeBSD: src/usr.bin/mail/head.c,v 1.8 2003/01/09 05:08:37 mikeh Exp $
$FreeBSD: src/usr.bin/mail/lex.c,v 1.16 2004/03/06 13:27:59 mikeh Exp $
$FreeBSD: src/usr.bin/mail/list.c,v 1.9 2002/06/30 05:25:06 obrien Exp $
$FreeBSD: src/usr.bin/mail/names.c,v 1.9 2004/02/29 20:44:44 mikeh Exp $
$FreeBSD: src/usr.bin/mail/popen.c,v 1.7 2002/06/30 05:25:06 obrien Exp $
$FreeBSD: src/usr.bin/mail/quit.c,v 1.7 2002/06/30 05:25:06 obrien Exp $
$FreeBSD: src/usr.bin/mail/send.c,v 1.14 2004/02/29 20:44:44 mikeh Exp $
$FreeBSD: src/usr.bin/mail/strings.c,v 1.5 2002/06/30 05:25:06 obrien Exp $
$FreeBSD: src/usr.bin/mail/temp.c,v 1.9 2002/06/30 05:25:06 obrien Exp $
$FreeBSD: src/usr.bin/mail/tty.c,v 1.6 2002/06/30 05:25:06 obrien Exp $
$FreeBSD: src/usr.bin/mail/v7.local.c,v 1.5 2002/06/30 05:25:06 obrien Exp $
$FreeBSD: src/usr.bin/mail/vars.c,v 1.4 2002/06/30 05:25:06 obrien Exp $
$FreeBSD: src/usr.bin/mail/version.c,v 1.4 2002/06/30 05:25:06 obrien Exp $
%3ld/%-5ld
/bin/sh
/usr/share/misc/mail.help
%d: %ld/%ld
%s/mail.RsXXXXXXXXXX
/dev/null
%s/mail.ReXXXXXXXXXX
%d/%d
/usr/share/misc/mail.tildehelp
/usr/bin/more
%d/%ld
/tmp
/usr/bin/ex
/usr/bin/vi
%s/mail.XXXXXXXXXX
~/mbox
%s/%s
~/dead.letter
~/%s
%s/mail.RxXXXXXXXXXX
0123456789$^.:/-+*'"
~/.mailrc
%s/mail.RqXXXXXXXXXX
%s/mail.RmXXXXXXXXXX
%s/mbox.XXXXXXXXXX
/usr/sbin/sendmail
/tmp/
/var/mail
8.1 6/6/93




On 13 Mar 2016, at 14:07, Larry Stone <lsto...@stonejongleux.com> wrote:

I run Postfix (built from source) on one of my Macs and installed into /usr/local. I turned off SIP in order to get my built version of /usr/sbin/sendmail there and have left it off. The only “pain” likely to result is if you aren’t smart and let malware do something bad. OS X (at least so far) does not care if SIP is on or off. SIP, IMHO, is protection for those who don’t know what they are doing but is in the way of us who know our way around a system. While Apple has thrown more barricades in the way of running your own locally built Unix software, they haven’t blocked it yet.

Turning off SIP is easy:
•   Restart your Mac, and as soon as the screen turns black hold down ⌘R until the Apple logo appears on your screen.
•   Now click on the "Utilities" menu, and then "Terminal".
•   In the Terminal Window type:
•   csrutil disable
•   Restart OS X, your Mac should then restart as normal with SIP disabled,
This is a permanent setting so once done would never need to be done again. But if you want to toggle it on and off as needed, to turn it on, just say “csrutil enable” instead.

--
Larry Stone
lsto...@stonejongleux.com






Robert Chalmers
Mac mini 6.2 - 2012, Intel Core i7,2.3 GHz, Memory:16 GB. El-Capitan 10.11.  XCode 7.2.1
2TB: Drive 0:HGST HTS721010A9E630. Upper bay. Drive 1:ST1000LM024 HN-M101MBB. Lower Bay




Robert Chalmers

unread,
Mar 13, 2016, 11:08:19 AM3/13/16
to
Interesting idea Wietse.

I’ll look into it.

Robert Wolfe

unread,
Mar 13, 2016, 1:01:06 PM3/13/16
to
Could you now just make a soft link to the files on /etc/old-postfix?

On 03/13/2016 01:58 AM, rob...@chalmers.com.au wrote:
> Let me explain what's happening, or what happened.
>
> I rebuilt Postfix, to install in /user/local/etc/postfix and set the command to be in /user/local/sbin and so on, and it all works fine, as it should.
> The reason I moved it, is because each time OSX updates, it overwrites /etc/postfix of course, and the OSX build doesn't do what I want postfix to do.
> Also, I find myself modifying /etc/postfix *.cf files, because I forget that I've moved the active version.
>
> So I renamed/moved /etc/postfix, to /etc/old-postfix. .which has been ok, except for 'mail'
> Eg
> echo date | mail rob...@chalmers.com
> Fails with
> 'can't find /etc/postfix/main.cf'
>
> It's the only thing that fails. I move old-postfix back to etc/postfix, and of course it works again.
> I need 'mail' to work, because it is used by crown if nothing else...
>
> So that's what made me wonder if it's related to postfix in some way, as it seems to need it.
>

@lbutlr

unread,
Mar 14, 2016, 12:02:02 PM3/14/16
to
On Mar 13, 2016, at 12:58 AM, rob...@chalmers.com.au wrote:
> So I renamed/moved /etc/postfix, to /etc/old-postfix. .which has been ok, except for 'mail'
> Eg
> echo date | mail rob...@chalmers.com
> Fails with
> 'can't find /etc/postfix/main.cf'
>
> It's the only thing that fails. I move old-postfix back to etc/postfix, and of course it works again.
> I need 'mail' to work, because it is used by crown if nothing else…

Did you replace the default sendmail with a link to your postfix build’s sendmail? This caused me trouble on my FreeBSD machine when sending mail from the command line.

--
Don't be afraid to be weak, Don't be too proud to be strong.

@lbutlr

unread,
Mar 14, 2016, 12:05:57 PM3/14/16
to
On Mar 13, 2016, at 9:06 AM, Robert Chalmers <rob...@chalmers.com.au> wrote:
> Nice hardware, but the software is really recycled FreeBSD. say what?

This should not be news. One of the reasons I chose FreeBSD for my servers was because I wouldn’t have to change modes between OS X and my servers.

--
Marriages made in heaven are not exported.

Robert Chalmers

unread,
Mar 14, 2016, 12:22:02 PM3/14/16
to
Yes, I moved the Apple /usr/bin/sendmail to /usr/bin/old-sendmail
Then created a symlink from my own build of sendmail. /usr/local/bin/sendmail to /usr/bin/sendmail, and now Apple’s mail works as it should.

The original complaint from mail when I moved the /etc/postfix directory to /etc/old-postfix was that it could no longer find /etc/postfix/main.cf - … it was actually Apple’s sendmail was looking for it
Now, my own sendmail knows where to find the config files. in /usr/local/etc/postfix

As far as I know, the only thing using “mail” on my machine is cron, and occasionally me when I’m testing something. and it works fine now.

Tom Hendrikx

unread,
Mar 14, 2016, 2:42:15 PM3/14/16
to
On 14-03-16 17:05, @lbutlr wrote:
> On Mar 13, 2016, at 9:06 AM, Robert Chalmers <rob...@chalmers.com.au>
> wrote:
>> Nice hardware, but the software is really recycled FreeBSD. say
>> what?
>
> This should not be news. One of the reasons I chose FreeBSD for my
> servers was because I wouldn’t have to change modes between OS X and
> my servers.
>

Hehe,

That is why I run ubuntu on my macbook. :P

Regards,
Tom

signature.asc
0 new messages