busy-bee.net buzz buzz buzz goes the honeybee home | blog | links | about me

linux to an imac


















tcsh paths
zsh, zsh, zsh
enforced insomnia
exporting read-write nfs directories
just noticed in jaguar





2002-08-29 12:28 / tcsh paths  »

It seems that 10.2 pulls /usr/local/bin out of your path. Put it back by adding setenv PATH "${PATH}:/usr/local/bin" to your ~/.tcshrc or ~/.cshrc file.

Oh, and the zsh stuff is a little wrong :-/ I don't think any recompilation in pursuit of bells and whistles is necessary, just the addition of some shared function files. Specifically promptinit for the prompts.

2002-08-22 10:20 / chimera  »

I've tried most of the OS X browsers available, but just ended up coming back to the default MSIE. Distressing. Netscape7 / Mozilla seems too slow and bloated, Opera for OS X isn't at all pretty and it seems to be bottom of their list of preferred platforms, Omniweb, well, it's sort of half finished standard-wise as well as being payware.

But chimera looked very promising last night (screenshot large, small). It was extremely quick - quicker than IE I thought; it uses the mozilla rendering engine so we have cross-platform uniformity (e.g. the new OS X AOL client), yet debloats by dumping the enormous feature set of Netscape; and the interface is extremely clean and simple, with tabs if you want them.

2002-08-22 20:50 / zsh, zsh, zsh  »

I'll rant one more time about this. Why bother changing shells, from the default tcsh to anything else? Well it's pointless unless you use the Terminal, of course. If you do though, and you're like me, and you like saving precious key-strokes (M-/ in emacs is yum-yum), then the first time you see someone contextually tab-complete in zsh, you'll be amazed.

tcsh and bash (coming in Jaguar, the default in linux) both auto-complete on commands. Type ni <tab> and you'll get a list of the commands starting with 'ni'. But zsh auto-completes on arguments to commands as well. Type cd <tab> and you'll get a list of directories - and only directories - that you can cd to. Type cvs -d <tab> and you get a list of the cvs repositories you've used in the past; man <tab> man pages; perldoc <tab> perldocs; and so on and so on. With cvs and the secure shell suite, it'll even connect to the remote server and auto-complete from there. So if you don't know the repositories you can access it'll find them for you. As I didn't for Apple (screenshot large, small).

Prettiness is another reason to switch. zsh has 'themed' prompts. Whereas - at least last time I tried - in bash if you want to change the colours or strings shown in your prompt, you have to either hack ~/.bashrc or else mess about writing shell functions, in zsh you just type prompt <promptname> <colour1> .. <colourn>, where promptname switches what gets shown and the colours switch the colours for the various parts (syntax, hostname, history number). (Screenshot large, small.) The colour change is particularly useful when you're switching hosts a lot within the same term.

Anyway, what to do if you're remotely interested? First you need to download and compile the latest distribution from www.zsh.org, because the default version with OS X doesn't seem to have all this nonsense compiled. Then, fetch my slightly hacked (e.g. no call to /bin/false) set of resource files, and extract into your home directory. I've included my .zsh_prompts which - whoopee - shows the version of Darwin and OS X you're using. Then, try zsh, try the tabbing stuff, and if you like it you can permanently change your shell. If it doesn't work (make sure it's the new version that you're calling, probably in /usr/local/bin), mail me and I'll try to help.

2002-08-16 12:19 / pmset  »

Well, man -k power is what I should've done first in the last entry. That brings up pmset - a command that 'changes power management settings such as idle sleep timing and wake on LAN' - perfect, and saves its changes in /var/db/SystemConfiguration/com.apple.PowerManagement.xml - also perfect since that's exactly the file that gets overwritten when you move the sliders up and down in energy saver (in 10.1.5).

But I couldn't get it to work. It just printed the usage message every time. In a fit of bravery though - having seen just how short the source code is - I thought I'd see where it was failing. So a checkout of IOKitUser, a separate download of IOPMLibPrivate.h, and I can compile my own version with cc -framework iokit -framework foundation -o pmset pmset.c. The result?: A few printfs shows that it dies basically because I don't have a battery. Even if I force it to ignore that fact, it dies on a bus error. So I guess it was just meant for laptops. Ho-hum.

2002-08-14 12:08 / enforced insomnia  »

Override your energy saving settings and stop the mac from ever sleeping with tail -F /var/log/system.log > /dev/null &. Again, useful to me for keeping remote ssh sessions open, and I might use it in combo with wakeonlan to start doing secret things in the middle of the night.

Incidentally your mac also won't sleep at all if you're running console.app, which does the same thing for a different file.

2002-08-09 10:45 / exporting read-write nfs directories  »

I've been trying to set up the imac (more specifically I suppose, a machine running Darwin) as an NFS server on my local domain. Now, there is a very good page here (pdf, as googled html) , that details all the NetInfo commands needed to set it up - all variations of niutil. However, no matter how much I mucked with the NFS options, e.g. niutil -createprop / 1235 "opts" "rw" "maproot=0", I couldn't get my directory to export read-write, just read-only.

So, I found this page (the relevant part a few paragraphs down), and there's another old-skool way to do it which unfortunately includes hacking a startup script: /System/Library/StartupItems/NFS/NFS, that'll probably be overwritten on every upgrade. An alternative to hacking would be to create one's own startup script, say myNFS and then turn the standard one off.

It's actually easier than the NetInfo way. You need an /etc/exports file, which has entries such as this for each exported directory: /export/bsdcvs -maproot=0 -network -mask (defaulting to read-write).

Now, the hack of /System/Library/StartupItems/NFS/NFS. The relevant part of mine looks like this:

if [ -f /etc/exports ]; then
    ConsoleMessage "Starting Network File System server"
    mountd /etc/exports
    nfsd -t -u -n 6

#exports=$(niutil -list . /exports 2> /dev/null | wc -w)
#if [ "${exports}" -gt 0 ]; then
#    ConsoleMessage "Starting Network File System server"
#    mountd 

     # If the NetInfo config/nfsd directory contains 
     # startup args for nfsd, use those.
#    arguments=`niutil -readprop . /config/nfsd arguments`
#    nfsd ${arguments:-"-t -u -n 6"}

The commented-out code below is how it used to look. Note that we're doing a file existence test now rather than one using NetInfo.

Finally, HUP all the daemons - or reboot:

sudo kill -HUP `ps -aux | grep -E "nfsiod|nfsd|mountd|automount" | grep -v grep | awk '{print $2}'`

Oh, I'm pretty sure you need AUTOMOUNT and RPCSERVER set to -YES- in /etc/hostconfig before any of this will work.

Maybe there is a way to get the NetInfo way working - which would be preferable - but I couldn't see it. This way works, and my FreeBSD box will be happier with its donated disk-space.

2002-08-07 10:35 / just noticed in jaguar  »

This is barely worth an entry since you could just go to apple. It just looks like the Jaguar Terminal.app is getting some new functionality, including 'vt100/vt220 emulation on par with xterm', a 'split view' (curious), transparency for anyone who hasn't yet hacked their .terms directly, and dumping of anti-aliasing if you feel like it. There's a complaint today though on cocoa-dev about it being (even) slower.

Oooh, and 10.2 comes with bash, ncurses (weh-hey), killall (ditto), and 'dozens of other "by popular request" enhancements'. These, I suppose, as a result of the FreeBSD 4.4 integration.

  mod_perl -- Speed, Power, Scalability