Tweaking
Terminal Commands – Leopard Tweaking
The default shell for Leopard users is Bash. Although many GNU/Linux users are familiar with it, not all Mac users take full advantage of its power. Here are some very useful terminal commands and tips for hidden Mac OS X settings.
You’ll find the Terminal in the Utilities folder within the Applications folder. To carry out any of the following commands you will need to copy/paste or type in the line of text then hit enter. For the most part, applications will need restarting before changes take place.
- Finder
- Dock
- Spaces
- Desktop
- Screensaver
- Time Machine
- Spotlight
- ISO CD/DVD
- Remote Desktop
- Network
- System commands
- Applications and processes
- Files management
Finder
- Removes the stripes in list view. Repeat the command with TRUE to reverse.
defaults write com.apple.finder FXListViewStripes -bool FALSE - Enable the hidden menu item within the Finder menu itself.
defaults write com.apple.finder QuitMenuItem -bool YES
You’ll have a “Quit Finder” menu item within the Finder menu itself.

- Resets the “Open With” menu, clearing duplicates.
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local -domain system -domain user - Changes the title of a window to its full path. Repeat with NO to reverse.
defaults write com.apple.finder _FXShowPosixPathInTitle -bool YES
- Sets expanded save dialogs as default (showing column/list view of folders rather than a drop down menu). Replace TRUE with FALSE to reverse.
defaults write -g NSNavPanelExpandedStateForSaveMode -bool TRUE

- Shows hidden files in the Finder. Replace TRUE with FALSE to hide hidden files again
defaults write com.apple.finder AppleShowAllFiles TRUE

- Relaunch Finder in 4 different ways
Simple way relaunch via terminal killall Finder - return to top
Dock
- Change to 2D Dock. To change back to 3D, repeat with NO at the end.
defaults write com.apple.dock no-glass -boolean YES

- Allows you to increase the size of the Dock past the maximum allowed by the slider in System Preferences. Don’t go larger than 256. Use the slider in System Preferences to shrink the Dock down again.
defaults write com.apple.dock tilesize -int 256 - Allows you to increase the Dock magnification past the maximum allowed by the slider in System Preferences. Don’t go larger than 512. Use the slider in System Preferences to shrink the Dock down again.
defaults write com.apple.dock largesize -int 512 - Makes all items in the Dock spring loaded. For example, hold a file over an application and it will open or come to the front so you can drop the file onto a specific window. Repeat with NO to reverse.
defaults write com.apple.dock enable-spring-load-actions-on-all-items -boolean YES - Quckly switch to next wallpaper picture in shuffle mode.
killall Dock - return to top
Spaces
- Changes the delay when dragging windows off the edge of the screen to other spaces. Default value is 0.75.
defaults write com.apple.dock workspaces-edge-delay -float 0.5 - Disables the wrap-around when using Control-Arrow keys to changes Spaces. To enable again, repeat with YES at the end.
defaults write com.apple.dock workspaces-wrap-arrows -boolean NO

- return to top
Desktop
- Increase Desktop Icon Size.
If you want massive icons on you desktop this little hack lets you increase the icons to 512 pixels x 512 pixels. This is massive, may slow down on older machines. I don’t think it goes larger than 512.defaults write com.apple.finder DesktopViewOptions -dict IconSize -integer 512 killall Finde
- Changing the Format Of Screen Shots.
If you use the screen shot function, you may want to change the format of the images, this is not easily done normally. Where jpg is in the code you can change this to the format your want:
png | bmp | gif etc… You need to log out and back in again, or restart for the changes to take effect.
defaults write com.apple.screencapture type jpg - Drag A Widget Onto The Desktop.
This command enables widgets to be placed onto the desktop. Drag a widget around and press F12 to drag it onto the desktop. Repeat the process again to drag a widget back onto the dashboard.
This may need you to log off or restart for it to take effect.
defaults write com.apple.dashboard devmode YES - return to top
Screensaver
- Require a password on waking from sleep, but not when screensaver is active.
defaults -currentHost write com.apple.screensaver askForPassword -int 0
Time Machine

- Changes Time Machine’s backup interval. Requires an administrator password. Default value is 3600 (seconds).
sudo defaults write /System/Library/LaunchDaemons/com.apple.backupd-auto StartInterval -int 7200 - Enable Time Machine On Unsupported Drives ( includeed NAS)
defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1 - return to top
Spotlight
- Disables the Spotlight icon. Type “killall Spotlight” for changes to take effect.
To re-enable it, type 755 instead of 0.
sudo chmod 0 /System/Library/CoreServices/Spotlight.app
killall Spotlight - return to top
ISO CD/DVD
- Create and burn a “universal” CD/DVD
mkisofs -allow-multidot -allow-leading-dots -d -hide-rr-moved \ -l -joliet-long -R -T -v \ -V VOLUME_NAME -o output.iso root-cd-dir/ hdiutil burn -noverifyburn output.iso
- Create an ISO image from a CD/DVD
diskutil unmountDisk /dev/disk2s0 dd if=/dev/disk2s0 of=cdname.iso bs=32m
- Mount a disk image from the command line
hdid diskimage.dmg (or .iso) - Eject a CD/DVD
drutil eject - return to top
Remote Desktop
- Starts the Remote Desktop service (useful if you only have SSH access but want to do something using the GUI on your client Mac). For more options, see: http://support.apple.com/kb/HT2370
sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -restart -agent - return to top
Network
- Displays network configuration for the primary Ethernet interface (en0).
ipconfig getpacket en0 - Getting current IP address on interface
ipconfig getifaddr en1 - This command can be used after acquiring mac’s, ip’s and hostname’s or any of the above from a freshly scanned LAN. User must be root, and remember to change your settings on your network managing software manually instead of ‘auto DHCP’. You can also substitute eth0 for wlan0 etc
ifconfig eth0 down hw ether (newmacaddresshere) && ifconfig eth0 up && ifconfig eth0 (newipaddresshere) netmask 255.255.255.0 up && /bin/hostname (newhostnamehere) - Changes (spoofs) MAC address until next reboot
ifconfig en0 ether 00:00:00:00:00:00 - Find MAC address
ifconfig en0 | grep ether | sed s/://g | sed s/ether// - Lists internet ports that are open. Use sudo if you want the ports open by all users, and the flags -n and -P will disable name resolution and port names and give you numbers instead.
lsof -i -n -P - Displaying a Active Network Connections on the Mac OS X
lsof -i | grep -E "(LISTEN|ESTABLISHED)" | awk '{print $1, $8, $9}' - Display the order for DNS resolution. Useful for when you’re creating or debugging your Network settings.
scutil --dns - A wget replacement in MacOS X
echo 'alias wget="curl -O"' >> ~/.bash_profile - return to top
System commands
- Reboots the computer
sudo reboot - Disables the unexpectedly quit dialog that normally appears when an application crashes. Replace “none” with “prompt” to enable again.
defaults write com.apple.CrashReporter DialogType none - Enable Rosetta support
sudo sysctl -w kern.exec.archhandler.powerpc=/usr/libexec/oah/RosettaNonGrata
To Re-Enable Rosetta
sudo sysctl -w kern.exec.archhandler.powerpc=/usr/libexec/oah/translate - return to top
Applications and processes
- Open an application
open /Applications/iTunes.app/ - List file size in human-readable units
ls -lh /dir/or/file - Force quits an application or kill a process or processes by name (e.g: the Dock). Pretty useful if you can’t get into Activity Monitor.
sudo killall -9 appname - return to top
Files management
- Change to the last directory you were in
cd /var cd /etc cd - # will take you to /var
- To go to your home folder
just type "cd ~" or even better "cd" - Create an empty file
touch /some/thing - Get the first 20 lines of a file
head -n 20 /some/thing - Get 20 lines from the end of a file
tail -n 20 /some/thing - Output the contents of a file
cat /some/thing - How to list and sort directories by size
du -kh | sort -nr | more - Find large files. If you want to quickly find out what the largest files(more than 100M) are in a directory, try following command.
find . -type f -size +100000k |xargs -I% du -sh %
or list the 40 heaviest files in your home directory
du -xak ~/ 2> /dev/null | sort -nr | head -n 40 - return to top


April 16th, 2010 at 12:40 PM
“Desktop
Increase Desktop Icon Size.
If you want massive icons on you desktop this little hack lets you increase the icons to 512 pixels x 512 pixels. This is massive, may slow down on older machines. I don’t think it goes larger than 512.
1 defaults write com.apple.finder DesktopViewOptions -dict IconSize -integer 512
2 killall Finder”
the command does not work. i tried 256 and it didnt work either. please help.
April 20th, 2010 at 2:34 PM
Eric, looks like trick about desktop icons doesn’t work anymore.
the maximum size is 128×128
click CMD+J on Desktop and use slider to change size of icons.
January 7th, 2011 at 12:04 PM
have you been able to figure out how to increase the response time to the open with menu in right click.
I want to have the ability to set the time. It drives me crazy when the computer grabs and will not move till it displays that menu.
August 6th, 2011 at 1:14 PM
Relating to the open application command; I use this
open -a textedit