Mac OS X notes

This is just a quick page with some tips to get around things that I've discovered so far with Mac OS X (as of the "official" release)

In order to avoid confusion from 'Mac users' - my motivation for buying a Mac was to play with Mac OS X... since the 'normal' Mac OS does a pretty thorough job of hiding most of the technical details of computing. For the most part... I'm just documenting things that come up as I try to integrate my Mac into an existing network of Linux machines.

First thing - enable the root account

For some reason... Apple doesn't make the root account setup part of the installation - so you'll probably realize you can't use the account the first time you have the need.

Quickest fix... just do a 'sudo passwd root' and run through the passwd prompts to establish your new root password.

There are other indirect ways to accomplish the same thing... but chances are you're already in a terminal.

tweaking the shell (tcsh)

I'm not an expert on configuring all the possible shells in the Unix world... but I at least needed to figure out how to make a few adjustments to the default tcsh setup.

I caught about 30 minutes of an 'official' Mac OS X demo - enough to pick up the point that a lot of configuration files could be in various 'Library' directories... for system-wide and per-user customization.

In particular... the default tcsh configuration files are in /usr/share/init/tcsh - including a README detailing how you need to make tcsh notice changes you might make to your environment, aliases, etc...

In a nutshell... a user can create an equivalent structure in ~/Library/init/tcsh to maintain his/her preferences for the shell. Alternatively, you could install additional shells (bash, ksh, etc...) if you have another preference.

ssh (secure shell)

I had a copy of one of the Mac OS X beta releases... and it included a copy of ssh - but Apple removed it from the official release and/or Developer Tools.

So... here's the solution -

First of all... you'll want to grab the source for openssl and openssh - but read the next tip before you grab openssl -

There *is* a libssl.0.9.dylib (equivalent to .so file on Linux, etc...) - but it was linked against the openssl-0.9.5.a source. In other words... grab the 0.9.5a version of the source if you want to minimize your effort..

Quick disclaimer - I installed all of the developer tools (GNU C compiler, Perl, etc...) - so I have no idea what you might be missing if you only installed Mac OS X without the developer stuff.

So... quick and dirty hack -

We can get away with just putting the openssl includes in an appropriate location... without bothering with the potential headaches of a full openssl compile.

Now you can compile and install openssh (just grab the latest version) as normal

If you grabbed the wrong version of the openssl source... you should get a complaint about your existing library, etc... and you'll need to grab the correct source ;-)

Printing

I still don't understand why Mac OS X has a lot of typical /etc configuration files... when the default configuration ignores them - probably just to tease a Unix administrator into thinking things will work as expected ;-)

My first impulse was to go into /etc/printcap and make some adjustments... but I opted for the graphical solution (does nothing to /etc/printcap... of course) since /etc/printcap is ignored by default.

If you go to Applications -> Utilities -> Print Center... it's trivial to set up a 'normal' lpr host. In my case... I clicked on 'Add Printer' - and selected 'LPR Printers using IP' from the dropdown on the 'Printer List' dialog.

If you have a real postscript printer on an lpr host... you should be able to just choose to print to the 'Default Queue' with the 'Generic' printer choice.

Finally... make any necessary adjustments to /etc/hosts.lpd or the equivalent on the print server if your network isn't friendly to alien machines ;-)

Unfortunately... I don't have a postscript printer at home - and I noticed that my previously working Appletalk configuration for Mac OS 9.x didn't quite work (maybe I'll look into fixing this later)

Long story short... I didn't really want to play with Appletalk after I was teased with the /etc/printcap file - so I looked at the man page for niload and eventually worked out a solution.

I borrowed the /etc/printcap from one of my Linux clients (not the printer server) and put the following in the /etc/printcap on Mac OS X -

In order to make the new printer available to your application - you need to load the printer information into the database with a command like the following -

The '/' seems to be the NetInfo domain for your local machine... as far as I can tell - and there are several 'aliases' for the typical configuration files you usually see in /etc on a Unix machine. Look at the man page for niload if you want to check the command syntax.

So... now that the /etc/printcap file is loaded into the NetInfo database... you can use the Print Center utility to add the printer you just defined. If you click on Add Printer... you should see the printer listed when Directory Services shows in the drop-down list.

A typical 'application' print job will probably run fine without lpd started (asking NetInfo for printers?) - but you should set a PRINTER environment variable if you want to use lpr from the command-line. Alternatively, you should be able to use lpr with the normal -Pprinter-alias option.

lpd wasn't running on my machine - so I searched the hard-drive, found it at /usr/libexec/lpd, and started it (as root)

But... a typical lp|alias1|alias2 entry doesn't seem to work with NetInfo? and/or lpr/lpd (doesn't treat lp as the default printer?) - so I changed the /etc/printcap entry to just have bjc4200 on the first line (instead of lp|bjc4200) and loaded /etc/printcap with niload again.

By the way... you can use the graphical NetInfo Manager to modify/delete entries in the NetInfo database - so I deleted the previous lp|bjc4200 entry... and added the printer again with the Printer Center utility (after loading the new /etc/printcap with niload)

(Of course you probably want to kill/restart lpd after you make the changes)

(and kill the appropriate process)

You should probably put something like setenv PRINTER myprinter in your shell initialization file (.tcshrc, etc...)

Finally... to make sure lpd starts when the machine boots - /etc/rc.common (processed by /etc/rc) looked like a good place to add /usr/libexec/lpd

 

And then there's printing with Samba...

I haven't tried compiling Samba on Mac OS X yet... but this would be another alternative for Macs to use printers in a Windows network.

This means you will be doing things with your /etc/printcap file and the smbprint script that is part of the Samba distribution.

Quick example... and maybe an explanation later ;-)

I print from a Linux machine at work using the following entries in my /etc/printcap file -

printcap entries can be pretty hideous ;-) - and I'm not sure there is a whole lot of purpose jumping into the ugly details. The relevant part is that the smbprint script ultimately handles sending the data to the Windows printer.

As in the earlier example... you'll probably want to change the first line to -

(since lpd doesn't seem to like 'lp' for a default printer... and you'll set the PRINTER environment variable instead)

Also... you'll need to create a subdirectory below /var/spool/lpd with the name of the printer you create (xerox_bw in the case above).

Finally... you need a .config file in the printer subdirectory (/var/spool/lpd/xerox_bw) with the details for the server you will be using -

(note I just needed the \ before the & above because it's a special character)

Of course you'll want to start/restart lpd and load the information into NetInfo using the earlier tips.

Ahhh... now I see ;-)

After the experience with niload and the /etc/printcap file... I suspect I can do the same kind of thing to the typical configuration files in /etc ;-)

I'll probably verify this later after I set up one of my Linux machines as an NIS server... and do some authentication/verfication tests on the Mac to see if it works as expected. On the other hand... I'm not an absolute NIS/netgroups guru - so it might take some extra fiddling to set up an appropriate test environment ;-)

Tweaking the 'dock'

I found a utility called Docking Maneuvers at http://homepage.mac.com/isleep/ that lets you adjust the orientation and 'pinning' of the dock.

Web browser

Hmmm... Internet Explorer 5.1 preview - appropriate name ;-)

The OmniWeb browser listed in the Mac OS X downloads on Apple's site is very decent... if you're looking for an alternative to Internet Explorer.

Mac OS X FAQ's

My overriding question so far is... 'How do I really make this act like Unix?' I'm still searching when I have time - but I stumbled across http://www.osxfaq.com when I found the dock tweaker. I'm not 'endorsing' this site... but I might peruse it later for ideas ;-)

In particular... I noticed instructions for getting lynx (text-based web browswer) to compile on Mac OS X final - which happens to be about the second thing I wanted on my system after a fresh Mac OS X install. Unfortunately... the compile from source still looks very messy - but I might give it a shot later. A lynx binary is available for download if you want a quick solution.

I grabbed the lynx binary and put it in /usr/local/bin, lynx.1 in /usr/local/man/man1, and created /usr/local/lib/lynx.cfg (just touched an empty file) when it complained on the first run.