Mac OS X Notes


Useful notes on Objective-C/Cocoa memory management

http://etoileos.com/dev/docs/languages/obj-c/

Disabling 'Wake on Lid Open' on Macbooks

To disable Macbook from automatically waking when screen is opened. Wise idea in case of inadvertant trigger while laptop is in bag, etc. sudo pmset -a lidwake 0

Enable path in finder window

For Leopard only. In terminal: defaults write com.apple.finder _FXShowPosixPathInTitle -bool YES

rsync+hfsmode

The default rsync will not include Mac metadata when the destination host is not using HFS+ as its filesystem. rsync+hfsmode will automatically create resource forks for the metadata and store them as dot files at the destination.

To backup: $ rsync-hfs --archive --delete --verbose --hfs-mode=appledouble --delete-excluded \\ --exclude=.Trash --exclude=Cache --exclude=Caches source dest

To restore: $ rsync -avz source dest $ /System/Library/CoreServices/FixupResourceForks dest

X11 forwarding

Enable X11 forwarding by uncommenting the X11Forwarding field and setting the value to yes in /etc/sshd_config

Activating root

In Leopard, enable option is under Edit menu in Directory Utility.app. In Tiger, under Netinfo Manager.app, go to Security→Enable Root User.

Adding & Setting Hostnames

To set hostname, in /etc/hostconfig, change HOSTNAME=-AUTOMATIC- to HOSTNAME=host.domain.

To change DNS resolution order: $ mkdir /etc/lookupd $ echo LookupOrder FFAgent CacheAgent DNSAgent NIAgent DSAgent >/etc/lookupd/hosts

To add hostnames to NetInfo database:

  1. Open Applications:Utilities:NetInfo Manager
  2. Click on machines, click on localhost
  3. Make duplicate
  4. Change name of duplicate to hostname
  5. Change p_address to IP address
  6. Leave serves alone

Java 1.5 in Tiger

http://docs.info.apple.com/article.html?artnum=301073

Can choose JRE version with /Applications/Utilities/Java/J2SE 5.0/Java Preferences applet

To change the native JDK used, as root: $ cd /System/Library/Frameworks/JavaVM.framework/Versions $ sudo rm CurrentJDK $ sudo ln -s 1.5 CurrentJDK