This subchapter looks at defaults, a Mac OS X command.
defaults is used to read, write, or delete defaults from a command line shell.
Teach Yourself UNIX/Linux System Administration and Shell Programming
table of contents
If you like the idea of this project,
then please donate some money.
more information on donating
This subchapter looks at defaults, a Mac OS X command.
defaults is used to read, write, or delete defaults from a command line shell.
Mac OS X programs use the defaults system to record user preferences and other information. Most of the information is more easily accessed through the applications Preferencess panel, but some information is normally inaccessible to the end user.
Note: Since applications do access the defaults system while theyre running, you shouldnt modify the defaults of a running application.
All programs share the defaults in NSGlobalDomain. If the program doesnt have its own default, it uses the value from the NSGlobalDomain.
The following methods use Terminal to change the default file format and location where the screenshot is saved from the graphic user interface.
In Mac S X 10.4 (Tiger) or more recent, the default screencapture format can be changed in Terminal by using the defaults command. In Mac S X 10.4 (Tiger), the new default does not take effect until you logout and log back in(from the entire computer, not just from Terminal a full restart will also work) unless you also use the killall command.
$ defaults write com.apple.screencapture type ImageFormat; killall SystemUIServer
The FileFormat can be png (Portable Network Graphic), pdf (Portable Document Format), tiff (Tagged Image File Format), jpg or jpeg (Joint Photographic Experts Group), pict (Macintosh QuickDraw Picture), bmp (Microsoft Windows Bitmap), gif (Graphics Interchange Format), psd (Adobe Photoshop Document), sgi (Silicon Graphics File Format), or tga (Truevision Targe File Format).
JPGs are saved at quality 60%.
To change the default location where the screenshot file is saved (the default is Desktop), use the following Terminal command (where pathname is the full path to a directory.:
$ defaults write com.apple.screencapture location PathName; killall SystemUIServer
The normal default location would be reset with the following command (where USername is the current accounts user name.
$ defaults write com.apple.screencapture location /Users/UserName/Desktop; killall SystemUIServer
Use the following commands to change the 3D Dock of Mac OS X Lion back to the 2D look. The killall restarts the Dock so that the change takes effect right away.
$ defaults write com.apple.dock no-glass -boolean YES; killall Dock
Return to the 3D look with the following commands:
$ defaults write com.apple.dock no-glass -boolean NO; killall Dock
Use the following commands to add a gradient behind an icon in a Dock Stack in Mac OS X:
$ defaults write com.apple.dock mouse-over-hilte-stack -boolean YES; killall Dock
Use the following commands to add a small Exposé button to the upper right of your Mac OS X screen. Clicking on the Exposé button will show all of the windows from the current application (same as the normal F10 default) and option clicking the Exposé button will show all windows from all programs (same as the normal F9 default). This will work even if you reconfigure the F9 and F10 keys to do something else.
$ defaults write com.apple.dock wvous-floater -bool YES; killall Dock
Use the following commands to remove the small Exposé button.
$ defaults write com.apple.dock wvous-floater -bool NO; killall Dock
Use the following command to add a message to your Login window. Replace message with a short message. Keep the message short. As always with the sudo command, type very carefully.
$ sudo defaults write /Library/Preferences/com.apple.loginwindow LoginwindowText "message"
To remove the login message, type the following:
$ sudo defaults write /Library/Preferences/com.apple.loginwindow LoginwindowText ""
The Mac OS X Finder hides all files that start with the period or dot character. This matches the standard behavior of ls in UNIX, where a leading dot is used as an indicator of a hidden file.
To have Finder always show all files, including hidden files, type:
$ defaults write com.apple.Finder AppleShowAllFiles YES; killall Finder
To restore Finder to its default behavior, type:
$ defaults write com.apple.Finder AppleShowAllFiles NO; killall Finder
To prevent Mac OS X from creating .DS_Store files on network shares (and everywhere else), type:
$ defaults write com.apple.desktopservices DSDontWriteNetworkStores true
To restore Mac OS X from creating .DS_Store files on network shares (and everywhere else), type:
$ defaults write com.apple.desktopservices DSDontWriteNetworkStores false
You can use defaults to determine if your Macintosh has been infected by the Mac Flashback Trojan (which enters your computer through a Java flaw).
Type the following command (copy and paste into Terminal):
$ defaults read /Applications/Safari.app/Contents/Info LSEnvironment
A clean system will report The domain/default pair of (/Applications/Safari.app/Contents/Info, LSEnvironment) does not exist. Any other result indicates your computer is infected.
If your computer passes the first test, type the following command (copy and paste into Terminal):
$ defaults read ~/.MacOSX/environment DYLD_INSERT_LIBRARIES
A clean system will report The domain/default pair of (/Users/user-name/.MacOSX/environment, DYLD_INSERT_LIBRARIES) does not exist. Any other result indicates your computer is infected.
If your computer is infected, immediately go to F-Secure.
Downloading the latest security patches from Apple will help prevent infection.
Coding example: I am making heavily documented and explained open source code for a method to play music for free almost any song, no subscription fees, no download costs, no advertisements, all completely legal. This is done by building a front-end to YouTube (which checks the copyright permissions for you).
View music player in action: www.musicinpublic.com/.
Create your own copy from the original source code/ (presented for learning programming).
return to table of contents
free downloadable college text book
free downloadable system administrator and shell programming book
Because I no longer have the computer and software to make PDFs, the book is available as an HTML file, which you can convert into a PDF.
Teach Yourself UNIX/Linux System Administration and Shell Programming
Building a free downloadable text book on computer programming for university, college, community college, and high school classes in computer programming.
If you like the idea of this project,
then please donate some money.
send donations to:
Milo
PO Box 1361
Tustin, California 92781
Supporting the entire project:
If you have a business or organization that can support the entire cost of this project, please contact Pr Ntr Kmt (my church)
Some or all of the material on this web page appears in the
free downloadable college text book on computer programming.
This web site handcrafted on Macintosh computers using Tom Benders Tex-Edit Plus and served using FreeBSD .
UNIX used as a generic term unless specifically used as a trademark (such as in the phrase UNIX certified). UNIX is a registered trademark in the United States and other countries, licensed exclusively through X/Open Company Ltd.
Names and logos of various OSs are trademarks of their respective owners.
Copyright © 2012 Milo
Created: July 4, 2012
Last Updated: October 15, 2012
return to table of contents
free downloadable college text book
free downloadable system administrator and shell programming book