Here is my collection of Apple Macintosh OSX hints, how-to's and personal notes.
CategoryComputer CategoryMacOsx

Finder.png

Nir Sofer's Macwiki מקמק
Apple hardware serial number lookup
AppleDefects.com

Page Tree

These are Terminal commands specific to Mac OSX. Commands that are common to other UNIX systems are on the Shell page.


Launch the OSX installer without forcing you to boot from the DVD disk:

open /Volumes/Mac\ OS\ X\ Install\ DVD/System/Installation/Packages/OSInstall.mpkg/

Just install a missing application:

open /Volumes/Mac\ OS\ X\ Install\ DVD/System/Installation/Packages/

then doubleclick on the desired application.


Replace your login screen background with a custom photo:

defaults write /Library/Preferences/com.apple.loginwindow DesktopPicture /System/Library/Screen\ Savers/Nature\ Patterns.slideSaver/Contents/Resources/NaturePatterns07.jpg}}

This example uses a large scrennsaver photo.
Notice that spaces in the path must be escaped with backslashes. Note that ScreensaverEngine seems to be unable to handle extended characters in the path, using a generic blue background instead.


Change the Login Window image here:

open /System/Library/CoreServices/SecurityAgent.app/Contents/Resources/


Change the screenshot image output type to .PNG:

defaults write com.apple.screencapture type png;killall SystemUIServer


Flatten Leopard's 3D Dock::

defaults write com.apple.dock no-glass -boolean YES ; killall Dock


To prevent Spotlight from indexing a disk, use this command from the root level of the disk:

touch .metadata_never_index


In 10.5, disable Time Machine's backup offer:

defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool YES


Get the Apple hardware serial number:

ioreg -l | awk '/IOPlatformSerialNumber/ {print $4}' | sed 's|\"||g'


To take a screenshot of the login window, ssh to the machine and use this command:

screencapture -xtpng Login_Window.png}}


Clear the DNS cache:

lookupd -flushcache


List all OSX machines on the localnet:

dns-sd -B _workstation._tcp

To terminate the command, press ctl-c.


Get battery voltage (portables):

ioreg -n battery -w 0 |grep IOBatteryInfo | sed 's|^.*Voltage\"=\(.*\),\"Flags.*$|Voltage:\1|' 


Load the processor:

yes >/dev/null

Press ctl-c to stop the loading.


Open a manpage as PDF:

man -t rsync | open -f -a Preview.app


List Finder metadata for an image file. Operates on a screensaver picture for example:

mdls /System/Library/Screen\ Savers/Forest.slideSaver/Contents/Resources/Forest12.jpg}}


Extract a sortable modification date for a file using the metadata command:

mdls ~/.MacOSX | sed -n '/ContentChangeDate/p' | sed 's|^.* \(.*\) \(.*\) .*$|\1+\2|'


Make a doubleclickable shell script by appending the .command extension to a text file containing a shell command. However, the command will not run unless its permissions are set to allow it to be executable. For beginners, it is probably easier to write an Applescript to send Terminal a script, I have hundreds of those kind of scripts on my Mac and I use them all the time.


Set Terminal to automatically steal the cursor:

defaults write com.apple.Terminal FocusFollowsMouse -bool YES


Disable Bonjour broadcast and listening until the next reboot:

sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.mDNSResponder.plist

For a persistent method of disabling Bonjour use the -w parameter, or ask for an Applescript that modifies the startup item.


List all applications and info:

system_profiler SPApplicationsDataType

Write the System Profile to a plain text file:

System_Profiler > ~/SystemProfile.txt

View and get the hostname:

scutil --set HostName Gnarlodious-MB
scutil --get HostName

System_Profiler -xml -DetailLevel -1 -xml > ~/`hostname`.spx


Display the Volume Information database:

cat /private/var/db/volinfo.database

See more at the IgnoreOwnership page.


List all connected AFP users:

netstat -na | grep 548

First address returned is this machine, second address is the remote machine and port.


Get the current Airport SSID:

ioreg -l -n AirPortDriver | grep APCurrentSSID | sed 's|^.*= "\(.*\)".*$|\1|; s| |_|g'


Get the Airport card MAC address:

ifconfig en1 | awk '/ether/ {print $2}' 


78-178   comment ouvrir le fichier metadata_never_index en francais
2007-10-11 08:17:23 X
Smiley: