? Earlier 6 items total Later ?

On this page:?

Mount and install OS X packages from the command line

If you need to install a .pkg application wrapped in a .dmg file from the command line (say, if you only have SSH access to the machine) there are a few command line utilities that will let you do this. For instance, let's say you're trying to install DarwinPorts on a remote OS X box.

cd ~/Desktop

curl -O http://darwinports.opendarwin.org/downloads/DarwinPorts-1.2-10.4.dmg

hdiutil attach DarwinPorts-1.2-10.4.dmg

cd /Volumes/DarwinPorts-1.2/

sudo installer -pkg DarwinPorts-1.2.pkg -target "/"

hditutil detach /Volumes/DarwinPorts-1.2/


In a nutshell, this 1) goes to your Desktop folder 2) grabs DarwinPorts from the opendarwin site 3) mounts the dmg 4) goes to the newly mounted DarwinPorts volume 5) installs the package, targeted to the root, as the root user 6) ejects the mounted disc image.

get rid of mac's ._ meta files on unix command line

When a mac accesses storage not formatted in it's own HFS format, it stores it's additional metadata about the file in another file named the same but starting with "._" It can be annoying and when you're accessing a remote volume that's source control managed with subversion, they show up your status information. This bash shell script will get remove of all ._metadata files residing below the current working directory.

#!/bin/sh
for i in `find . -regex '.*\._.*'`; do rm $i; echo "removing $i"; done


If you save that as "/home/$USER/bin/cleanup" and do a "chmod 777 /home/$USER/bin/cleanup" it will be available next time you open a terminal by just typing "cleanup".

Mute Remote Macintosh

Sometimes I am in bed and too lazy to get out to mute my G5. I can just grab my iBook, SSH into the G5 and run the following command:

osascript -e 'set volume output muted true'


brilliant!

Fried mac 'n' cheese

Recipe Summary
Difficulty: Easy
Prep Time: 20 minutes
Cook Time: 5 minutes

Leftover baked macaroni and cheese, refrigerated for at least overnight
1 cup all-purpose flour
1 teaspoon salt
1 teaspoon pepper
1 teaspoon cayenne
1 egg beaten with 2 ounces water
1 cup panko bread crumbs
Oil for deep frying, preheated to 375 degrees

Cut refrigerated macaroni and cheese into slices or bite size pieces.
Season the flour with salt, pepper and cayenne. Dredge each piece through the flour and gently tap off excess. Dip in the egg wash and then coat with the bread crumbs. Allow them to rest for 5 minutes so the crust can set. Very carefully drop into the oil and fry until golden brown. Remove to a baking sheet fitted with a rack and rest for 2 minutes before serving.

(c) Food Network, Alton Brown

Search for open files that won't allow you to unmount a server volume

lsof | grep "Office Server"

Lists out all open files on a given volume ("Office Server" in this case.) Good to find those peskey open files that won't let you eject a mounted network volume.

lighttpd as a startup item on os x

Create the /Library/StartupItems/Lighttpd directory, put both the Lighttpd (chmod +x) and the StartupParameters.plist (I don't really know what this does at all) files into the directory. (this is on jaguar, before the new launchd came out in tiger).

Then add the following line to /etc/hostconfig:

LIGHTTPD=-YES-


You can start, stop and restart lighttpd using /Library/StartupItems/Lighttpd (start|stop|restart) now, and it will startup when OS X boots.

-------- Lighttpd
#!/bin/sh
#
# /Library/StartupItems/Lighttpd/Lighttpd
#
# Script to startup lighttpd with OS X booting.
# OS X 10.3 Jaguar
# modified by kjell olsen
#
# adapted from the startup mysql
# (c) 2003 MySQL AB
# Written by Lenz Grimmer 
#

# Suppress the annoying "$1: unbound variable" error when no option
# was given
if [ -z $1 ] ; then
        echo "Usage: $0 [start|stop|restart] "
        exit 1
fi

# Source the common setup functions for startup scripts
test -r /etc/rc.common || exit 1
. /etc/rc.common

# change config and script to match your machine's lighttpd config and lighttpd
CONFIG="/etc/lighttpd/lighttpd.conf"
SCRIPT="/usr/local/sbin/lighttpd"

StartService () 
{
  if [ "${LIGHTTPD:=-NO-}" = "-YES-" ] ; then
    ConsoleMessage "Starting Lighttpd Server"
    $SCRIPT -f $CONFIG
  fi
}

StopService ()
{
  ConsoleMessage "Killing Lighttpd Server"
  kill `cat /var/run/lighttpd.pid` 
}

RestartService ()
{
        ConsoleMessage "Restarting Lighttpd server"
        /Library/StartupItems/Lighttpd/Lighttpd stop
        /Library/StartupItems/Lighttpd/Lighttpd start
}

if test -x $SCRIPT ; then
        RunService "$1"
else
        ConsoleMessage "Could not find lighttpd startup script!"
fi

Be sure to change $SCRIPT + $CONFIG to work with your own lighttpd.

-------- StartupParameters.plist




        Description
        Lighttpd 1.13
        OrderPreference
        None
        Provides
        
                Lighttpd
        
        Uses
        
                Network
                Resolver
        
        



Again, I'm not exactly sure what this does. I copied it from the MYSQL one and changed the description and provider, left "uses" alone.

? Earlier 6 items total Later ?