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.


  • Removes the stripes in list view. Repeat the command with TRUE to reverse.
    defaults write FXListViewStripes -bool FALSE
  • Enable the hidden menu item within the Finder menu itself.
    defaults write 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 _FXShowPosixPathInTitle -bool YESfinder-full-path
  • 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
    open/save expanded save dialog
  • Shows hidden files in the Finder. Replace TRUE with FALSE to hide hidden files again
    defaults write AppleShowAllFiles TRUE
  • Relaunch Finder in 4 different ways
    Simple way relaunch via terminal killall Finder
  • return to top


  • Change to 2D Dock. To change back to 3D, repeat with NO at the end.
    defaults write 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 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 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 enable-spring-load-actions-on-all-items -boolean YES
  • Quckly switch to next wallpaper picture in shuffle mode.
    killall Dock
  • return to top


  • Changes the delay when dragging windows off the edge of the screen to other spaces. Default value is 0.75.
    defaults write 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 workspaces-wrap-arrows -boolean NO
  • return to top


  • 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 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 type jpg
  • Drag A Widget Onto The Desktop.
    widgets_desktopThis 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 devmode YES
  • return to top


  • Require a password on waking from sleep, but not when screensaver is active.
    defaults -currentHost write 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/ StartInterval -int 7200
  • Enable Time Machine On Unsupported Drives ( includeed NAS)
    defaults write TMShowUnsupportedNetworkVolumes 1
  • return to top


  • 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/
    killall Spotlight
  • return to top


  • 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:
    sudo /System/Library/CoreServices/RemoteManagement/ -restart -agent
  • return to top


  • 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 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
  • 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 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/
  • 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

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s