[Pythonmac-SIG] Guide to installing Unix-Python on MacOS X

Bob Savage bobsavage@mac.com
Thu, 17 May 2001 23:36:55 -0700


Great feedback folks, keep pointing out those errors. I don't want to post
another version to the list if there are still things to fix, so I'll wait a
couple days, but I'll make the updated version available on my Stanford
website as soon as I can (there's some problem with the server, so I'll have
to do it tomorrow):

http://www.stanford.edu/~bsavage/

I'm leaving here in a couple of months however (I'm leaving Silicon Valley
for Nashville in July, "Hello, culture shock!"), so a more permanent home
for it might be appropriate.


on 5/17/01 2:43 PM, Jack Jansen wrote:
> - Why do you do the chown in the first place? There's no reason Python
> can't be owned by you (the installer). Making things root-owned
> without good reason to do so is a bit of a nono in unix-circles.

Hmmm... that may be true, but I changed the guide to use the "make install"
command so I don't have to do the move (or the chown) anymore, besides I
don't think the way I did it copied everything. However to use "make
install" I need to sudo.

> - Instead of the
> sudo mv /usr/local/bin/python.exe /usr/local/bin/python
> it might be better to do
> ln -s /usr/local/bin/python /usr/local/bin/python.exe
> That way, if you install a newer build later the "python" executable
> will refer to the new one automatically.

That is an excellent idea! I added it to the file.

> Oh yes, and I think there's
> no reason for the sudo: if you're an administrator you should be able
> to write in /usr/local/bin yourself.

No, I think you need to be root:

[localhost:/usr/local] bsavage% mkdir ./test
mkdir: ./test: Permission denied


on 5/17/01 10:42 AM, Chris Barker wrote:
> Also the "make install" option is certainly one worth considering.

Yeah, I fixed that :blush:

> If you need to do some stuff as root, "sudo" works, but then you have to
> typw it for each command. OS-X should have the "su" command.

No, it doesn't work:

[localhost:/usr/local] bsavage% su
Password:
Sorry

The command is there, but root doesn't have login privileges by default.
This is part of the security precautions. I figure people who know what su
is and enable it themselves know to use that, but I'm not going to tell
people to enable root login (too much trouble and I don't want to be the one
to encourage people to disable a security measure, especially when there is
a reasonable alternative -- it works, just a little extra typing).

>> %sudo chown -R root /usr/local/lib/python2.1
>> %sudo chgrp -R wheel /usr/local/lib/python2.1/Lib/
> 
> hmm. this is interesting. If this files were created as root, then they
> should already be owned bu root, and no one else is allowed to write to
> /usr/local anyway.

Actually the way I did it was to create them as bsavage and then move them
as root (via sudo). This was the wrong way to do it. I fixed the guide to
use "make install".

>> 
>> cat > ~/Library/init/tcsh/rc.mine
>> 

Actually I don't seem to need to do this anymore since I used the "make
install" command. I guess it does something I don't understand.

>> %python
>> 
>>> From here on out it should be just like in the Unix-centric documentation
> 
> Question: does readline work here, i.e. can you hit the up arrow to get
> you previous command(s), and then edit them and run them again? That
> really makes using the interpreter a practical thing to do, unlike the
> MacPython interpreter.

I love readline, but it doesn't work. If anyone knows how to enable it (or
anything else I didn't do right -- that thread error is troublesome -- just
speak up. I'll fix the guide and then no one will be without again :)
 
Another use to having the interpreter (well, actually I think it is damned
cool regardless) is that when people first start out they can learn with it
and use all those goofy unix scripts they start you out on in the books. At
least they did in my day (the Lutz tome), I see a new book every day on
learning Python in the bookstore.

> execfile("pythonfile.py") this lets you run a python script and get the
> command prompt back when it is done.

Cool. There used to be this great feature in Terminal which let you create a
shell command as a "service" which was then accessible from any Cocoa app. I
used this a lot in Public Beta to insert dates and change the case of text.
Unfortunately not only was there no support in the Finder (a Carbon app),
but they also shut the feature off because of some problems in the final
release. I hope they bring it back, because then python scripts can be
available **inside other programs**!

Anyway, keep those suggestions coming!

Bob