Archive for the 'macintosh' Category

When Remote Disc does not appear on Mac OS X

I’ve used the remote disc feature of OS X a few times. It’s pretty easy: you enable CD and DVD sharing on one Mac, and put the DVD in it. Then on the other Mac, you click on Remote Disc in the Finder sidebar, and you can attach the remote disc.

This is exactly what the online help from Apple says, and it works great, except when it doesn’t.

Sometimes, the Remote Disc item just isn’t there in the sidebar. And there’s no way to make it appear, in finder preferences or system preferences.

For example, I was able to do this from my Mac Mini; Remote Disc was there. But on my iMac, and most critically on the Macbook I was trying to set up that had a broken DVD drive, it was not there.

Here is the command line magic you need:

defaults write com.apple.NetworkBrowser EnableODiskBrowsing -bool true
defaults write com.apple.NetworkBrowser ODSSupported -bool true

Then you need to log out and log back in again (or maybe just kill Finder?).

How to enable ip forwarding on Leopard Mac OS X

In a nutshell, you need to create a launchd script. Here is mine, which I put in /Library/LaunchDaemons.


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.billo</string>
<key>Program</key>
<string>/usr/sbin/sysctl</string>
<key>ProgramArguments</key>
<array>
<string>sysctl</string>
<string>-w</string>
<string>net.inet.ip.forwarding=1</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>TimeOut</key>
<integer>90</integer>
<key>WorkingDirectory</key>
<string>/var/root</string>
</dict>
</plist>

That’s the hard way.

The easy way is to create or edit /etc/sysctl.conf and add

net.inet.ip.forwarding=1

Duh.

Black MacBook or Air?

It’s time for a new laptop. Should I get a black MacBook or a MacBook Air? I keep waffling. I basically use it for remote access to my work/home desktop computers, for web browsing and email.

Black:

Faster (33%50%)
More Disk Space (3X)
Faster Disk (5400RPM)
Has DVD
Cheaper ($300)

Air:

Awesome LED backlit display
Smaller

I’m leaning towards the BlackBook.

Update: BlackBook it is! What put me over the edge (aside from *cough* $300) was lack of an ethernet port on the Air. I don’t want to carry around a stupid dongle to plug in to a LAN.

Bookmark: all the good detailed documention for Mac OS X Server

You’d think this would just be on the install DVD, but I couldn’t find it.

http://www.apple.com/server/macosx/resources/

How to point your local Macs to a Leopard Server for Software Update

I’m playing around with Leopard server for my wife’s work. While it pains me to pay $500 for an operating system, Leopard server does make a number of things very easy that should save me way more than that much in time and frustration.

One of the things you can set up on a Leopard server is the software update service. This is akin to setting up a yum repository on your local LAN for Red Hat or whatever they call the distro thing on Debian. It’s pretty easy/obvious to set up the server side; you just turn on the service, it shows ALL the software updates from Apple from forever (or so it seems). Then it starts downloading them to the server.

What is not obvious is how to point your local Macs to this update server instead of the one at Apple. At my wife’s work, they will have 10-15 Macs, so it can save a lot of bandwidth/time if every single machine can download patches locally.

I find this kind of situation quite often in Leopard server (and previous versions of OS X server as well.) Apple creates a feature that clearly does what you want, but does not document the client half of things very well. One is left to search the web, and eventually stumble upon the answer in a forum or on a blog.

So what’s the answer? On your client machine, do this:

% defaults write /Library/Preferences/com.apple.SoftwareUpdate CatalogURL "http://10.0.67.13:8088/"

This assumes that your SERVER is at IP address 10.0.67.13. Yours probably isn’t. You can also use a DNS name, or a name from your local /etc/hosts file.

I found this in an apple discussion article.

Some further digging revealed the answer deep in this document, on page 88.

Update: to undo, and go back to apple as software update source:

defaults delete /Library/Preferences/com.apple.SoftwareUpdate CatalogURL

PostgreSQL on Leopard

These instructions worked well. The one problem I had was my openssl is out of sync with the latest 8.3 version, so I just configured without ssl.

./configure --prefix=/usr/local/pgsql \
--enable-thread-safety \
--without-docdir \
--with-perl \
--with-gssapi \
--with-pam \
--with-bonjour \
--without-openssl

Simplified remote access on Leopard

My friend Russ found this. I can’t believe I didn’t know about it, and I can’t believe how incredibly awesome it is.

I’ve found that the “back to my mac” functionality in Leopard to be incredibly disappointing. I have a lot of Macs that I either own or am responsible for in some way: a couple at home, some at work, and a bunch at my wife’s practice. Using VNC viewers like Chicken of the VNC is incredibly inefficient and slow. So I was hoping that the “back to my Mac” thing would let me not only use the more efficient Apple optimizations to remote access, but blow through firewalls so I wouldn’t have to use ssh tunnels.

But back to my mac almost never works for me. I think I got it to work once, when I was at home, and accessing the other Mac I have at home. That’s not a very interesting use case.

Anyway, I had resigned myself to staying on Apple Remote Desktop, which is a really nice application, but is also total overkill for what I want to do most of the time: just get access to a desktop.

So, that’s all a lot of annoying background to get to a simple how-to. If you have enabled remote management on a mac, and you want to open the Leopard screen-sharing application, just do this in a terminal:

open vnc://IPADDRESS-OF-REMOTE-MAC

Add your own boot command script to Mac OS X

If you have some things you want to start when your mac boots, here is how to do it. I use mine to start up an SSH keychain, start a mysql server and a memcached.

First, you’ll need to be root:

sudo tcsh

Now, make a directory for your stuff. Suppose your name is “Buffy.”

mkdir /Library/StartupItems/buffy
chown root /Library/StartupItems/buffy
chmod 755 /Library/StartupItems/buffy

You need to put two files in this directory. The first one is called StartupParameters.plist and should look like this:

{
Description = "buffy";
Provides = ("buffy");
Requires = ("Network");
OrderPreference = "Late";
Messages = {
start = "Starting buffy";
stop = "Stopping buffy";
};
}

If you were some kind of Darwin super guru, you could set all kinds of other options in here, but let’s pretend for now that you just want to save yourself remembering to type extra stuff after you reboot your mac. Crap that sentence was ugly. Sorry.

OK, now you need to write the actual script to start things. name that file buffy

Here is an example:

#!/bin/sh

##
# buffy local stuff
##

. /etc/rc.common

StartService ()
{
    ConsoleMessage "buffy startup"
    # start postfix mail server
    postfix start
    # this is some weird stuff that only i'm interested in
    # but I'm sure  you have similar weird stuff
    /r9/mysql1/bin/r9mysqld start
    export EVENT_NOKQUEUE=1
    # note the 'su' things so these process run as the 'buffy' user
    su buffy -c '/usr/local/bin/memcached -d -m 128 -p 11211'
    su buffy -c 'sh /Users/billo/bin/keychain'
}

StopService ()
{
    ConsoleMessage "buffy shutdown"
    /r9/mysql1/bin/r9mysqld stop
}

RestartService ()
{
    StopService
    StartService
}

RunService "$1"

Make sure the files you create are owned by ‘root’ otherwise OS X will ignore them.

How to Change the Default Background Image in Leopard

no-stars-dammit

I really don’t like the astronomy picture as a default background. I think I’ve gone through all the stages of personal computer decorative design, including crazy transparent terminals, shifting slideshow backgrounds, etc. I’m now at the stage where I want my visual environment to be boring, austere. I always choose a solid, medium-grey background. I turn off all visual transition effect i possibly can. I really just want to see the programs I’m working with. Anything else is more than my tiny brain can handle comfortably.

So, in Leopard, to get rid of space-the-final-frontier or whatever it’s called, do this:

First, make a screenshot of a piece of gray background, call it boring.jpg. Then:


sudo tcsh
cd /System/Library/CoreServices
mv DefaultDesktop.jpg DefaultDesktop_leopard.jpg
cp ~/boring.jpg DefaultDesktop.jpg

ssh slow on Leopard.

I thought I was going crazy, but I’m not. ssh to a host the first time is super slow on leopard.

This thread on apple forums has a lot of false leads, but includes the true cause:

“Assuming you are referring to problems when ssh-ing from a Leopard box
to other systems, then the problem is probably the new behavior of the
getaddrinfo() call in Leopard. Basically, that call in Leopard now uses
the RFC-recommended practice of first issuing a DNS SRV record request
rather than an A record request, and then falling back to the A record
request if the SRV request fails; unfortunately, apparently a lot of DNS
servers don’t respond to the SRV request w/ an NXDOMAIN as they should,
and instead just drop the request, so getaddrinfo() retries the SRV
request a few times, and only after those requests time out does it try
to A request. So if ssh is using getaddrinfo() rather than
gethostbyname/getservbyname, then you it would hang like you describe
whenever you are pointing to a DNS server that doesn’t respond well to
the SRV request. (There are also reports that Leopard may generate DNS
requests w/ an invalid RR type, which might explain why the servers
being queried aren’t responding to them correctly.)

The easiest way to check if that’s your problem would be to sniff
traffic on port 53 while trying an ssh connection, and seeing if your
box is making a SRV request or an A request. (If that is in fact your
problem, you may be SOL until a patch is released, as Googling, I don’t
see any solutions other than hacking individual apps to use
gethostbyname() instead of getaddrinfo().)”

I did monitor port 53 and it is making SRV requests.

I have not yet found a good way to workaround this behavior.

Another good discussion of this is here.

This seems kinda stupid to me, since we use bind for our DNS here at work. If a vanilla bind config doesn’t answer SRV requests properly, it seems bad to build them into the default behavior of a major client (like ssh).

Update: we upgraded all our DNS servers here at work, and they all repond to SRV requests properly, and now everything works great.