Archive for Mac OS X

I just upgraded my MacBook Pro’s hard drive to one with a bigger capacity. After restoring the contents from the old drive to the new one using an image created by SuperDuper!, I keep on getting this error every time I launch the Terminal application:

dyld: shared cached was built against a different libSystem.dylib, ignoring cache

After googling around, I found this discussion thread from Apple’s Support Forum on how to fix the error:
sudo update_dyld_shared_cache -force
Categories : Mac OS X
Comments (0)
Feb
01

How to determine DST time changes

Posted by: celso | Comments (0)

Here’s how to determine the dates when the Daylight Savings Time changes for a given year (I keep forgetting how to do this.):


zdump -v /etc/localtime|grep 2008 /etc/localtime Sun Mar 9 06:59:59 2008 UTC = Sun Mar 9 01:59:59 2008 EST isdst=0 gmtoff=-18000 /etc/localtime Sun Mar 9 07:00:00 2008 UTC = Sun Mar 9 03:00:00 2008 EDT isdst=1 gmtoff=-14400 /etc/localtime Sun Nov 2 05:59:59 2008 UTC = Sun Nov 2 01:59:59 2008 EDT isdst=1 gmtoff=-14400 /etc/localtime Sun Nov 2 06:00:00 2008 UTC = Sun Nov 2 01:00:00 2008 EST isdst=0 gmtoff=-18000

Obviously, change 2008 to whatever year you want.

Categories : Linux, Mac OS X, Notes
Comments (0)
Aug
28

Bourne Shell Logging Routine

Posted by: celso | Comments (0)

Here’s another logging routine, this one is written in Bourne shell:

#!/bin/sh

log_message() {
    echo `date "+%m/%d/%y %H:%M:%S %Z"` "$1" | tee -a aaa.out
}

log_message "Hello there"
log_message "Goodbye"

Sample output:

08/28/07 23:16:13 EDT Hello there
08/28/07 23:16:13 EDT Goodbye

Categories : Linux, Mac OS X, MySQL, Notes
Comments (0)
Jun
07

Determining the External IP Address

Posted by: celso | Comments (0)

Here’s how to find out your external IP address courtesy of this hint:

http://www.macosxhints.com/article.php?story=20060602180942480


curl --silent http://checkip.dyndns.org
    | awk '{print $6}' | cut -f 1 -d "<"

If you are using Apple's Airport Extreme Basestation (mine is particularly the Time Capsule and this is where I have tested this), and you have the SNMP interface enabled, you can run the following command


prompt$ snmpwalk -Os -c public -v 1 192.168.63.1 ipAdEntAddr IpAddress \
    | grep -E -v '(127.0.0|169.254|192.168.63.1)' \
    | cut -d : -f 2 | sed 's/ //g'
Categories : Linux, Mac OS X, Notes
Comments (0)
Apr
13

Line Terminations

Posted by: celso | Comments (0)

Line terminations for different operating systems:

unix 0×0a LF
Classic Mac 0×0d CR
Windows 0×0d 0×0a CR LF

To convert a text file with DOS line termination to UNIX line termination:


tr -d '\015' < winfile.txt > unixfile.txt

or


sed s/.$// winfile.txt > unixfile.txt

To convert a unix file to a DOS file:


sed s/$/\x0d/ unixfile.txt > winfile.txt
Categories : Linux, Mac OS X, Notes
Comments (0)
Feb
11

Run Periodic Maintenance Scripts Manually

Posted by: celso | Comments (0)

Mac OS X has to run some maintenance scripts in the middle of the night to do some important housekeeping tasks. If you have a Mac that sleeps in the middle of the night, as you do, you need to run these manually by running this from the shell:


sudo periodic daily weekly monthly
Categories : Mac OS X, Notes
Comments (0)
Sep
10

Change Behavior of iTunes Arrows

Posted by: celso | Comments (0)

Starting with iTunes 4.5, Apple implemented those little grey arrows next to the song title, artist, and album, which will take you to the corresponding match in the iTunes Music Store. To change the behavior of these arrows so that instead of going to the store, it will take you to your library instead, you can do either one of two ways:

  1. Hit option key when you click the arrow.
  2. Change it permamnently by executing this from the terminal:
    defaults write com.apple.iTunes invertStoreLinks -bool YES

    Make sure iTunes is not running when you execute this command.

Categories : Mac OS X, Notes
Comments (0)
Sep
08

Enable Safari Debug Menu

Posted by: celso | Comments (0)

To enable Safari Debug menu from the command line:

% defaults write \
com.apple.Safari IncludeDebugMenu 1

Make sure Safari is not running when you run this command.

Categories : Mac OS X, Notes
Comments (0)