Geek Posted September 9, 2011 Posted September 9, 2011 <div class="KonaBody"><p><img src="http://osxdaily.com/wp-content/uploads/2011/09/bash-script-to-customize-mac-os-x.gif" alt="Bash script to customize many aspects of Mac OS X " title="bash-script-to-customize-mac-os-x" width="620" height="394" class="aligncenter size-full wp-image-21085" /></p> <p>If you’re an <strong>advanced user</strong> and setting up a new Mac, you probably customize the OS with a ton of <a href="http://osxdaily.com/tag/defaults-write/">defaults write commands</a> and .alias adjustments. These are things you can either enter manually, use an <a href="http://osxdaily.com/2011/08/19/lion-tweaks-customizes-mac-os-x-features-easy/">easy tool like LionTweaks</a>, or check out this new <a href="https://github.com/mathiasbynens/dotfiles/blob/master/.osx">great script from GitHub called .osx</a>. </p> <p><strong>Note:</strong> this is obviously geared towards more advanced users who are comfortable with the <a href="http://osxdaily.com/category/command-line/">command line</a> and understand what changes they are making. Read the full article to see if these adjustments are right for you. If any of this seems confusing, you probably shouldn’t be making these changes or at least using this method, and the aforementioned LionTweaks utility may be a better fit. Proceed at your own risk.</p> <h2 style="font-size:1.2em;">Option 1) The Full Suite: customize .bash_profile, .bash_prompt, .aliases, git, and Mac OS X with defaults writes</h2> <p>If you want to make a ton of settings adjustments to .bash_profile, .aliases, .gitconfig, and all of the below defaults write commands, you can use this git command in the Terminal to do everything. Before jumping into this one, it’d be a good idea to <a href="https://github.com/mathiasbynens/dotfiles">review the files yourself</a> to make sure the changes are things you want. </p> <p><code style="font-size:85%;">git clone https://github.com/mathiasbynens/dotfiles.git && cd dotfiles && ./bootstrap.sh</code></p> <p>The .aliases file is pretty useful, but includes some commands like ngrep that are not preinstalled by default, so you’ll need homebrew or otherwise to install those.</p> <h2 style="font-size:1.2em;">Option 2) The defaults write changes to Mac OS X only</h2> <p>If you’re not interested in all of the terminal adjustments and aliases, you can just also just <a href="https://raw.github.com/mathiasbynens/dotfiles/master/.osx">get the .osx file from this link</a></p> <p>In either case, after git is finished or you have grabbed the .osx file yourself, you can execute the script with:</p> <p><code>./.osx</code></p> <p>This will activate all of the commands listed below at once. We’ve covered just about all of these before but having them in a centralized location and easily writable from a bash script is very useful when you’re setting up a new Mac.</p> <h2 style="font-size:1.2em;">Option 3: Selectively customizing OS X by entering the defaults write commands yourself</h2> <p>Here’s the full list of defaults write commands that are contained within the .osx file, review this before launching the script or just pick and choose which ones you want to use by putting them into the Terminal:</p> <blockquote><p><strong># Enable full keyboard access for all controls (e.g. enable Tab in modal dialogs)</strong> defaults write NSGlobalDomain AppleKeyboardUIMode -int 3</p> <p><strong># Enable the 2D Dock</strong> defaults write com.apple.dock no-glass -bool true</p> <p><strong># Disable menu bar transparency</strong> defaults write -g AppleEnableMenuBarTransparency -bool false</p> <p><strong># Expand save panel by default</strong> defaults write -g NSNavPanelExpandedStateForSaveMode -bool true</p> <p><strong># Expand print panel by default</strong> defaults write -g PMPrintingExpandedStateForPrint -bool true</p> <p><strong># Disable shadow in screenshots</strong> defaults write com.apple.screencapture disable-shadow -bool true</p> <p><strong># Enable highlight hover effect for the grid view of a stack (Dock)</strong> defaults write com.apple.dock mouse-over-hilte-stack -bool true</p> <p><strong># Enable spring loading for all Dock items</strong> defaults write enable-spring-load-actions-on-all-items -bool true</p> <p><strong># Disable press-and-hold for keys in favor of key repeat</strong> defaults write -g ApplePressAndHoldEnabled -bool false</p> <p><strong># Disable auto-correct</strong> defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false</p> <p><strong># Disable window animations</strong> defaults write NSGlobalDomain NSAutomaticWindowAnimationsEnabled -bool false</p> <p><strong># Disable disk image verification</strong> defaults write com.apple.frameworks.diskimages skip-verify -bool true defaults write com.apple.frameworks.diskimages skip-verify-locked -bool true defaults write com.apple.frameworks.diskimages skip-verify-remote -bool true</p> <p><strong># Automatically open a new Finder window when a volume is mounted</strong> defaults write com.apple.frameworks.diskimages auto-open-ro-root -bool true defaults write com.apple.frameworks.diskimages auto-open-rw-root -bool true</p> <p><strong># Avoid creating .DS_Store files on network volumes</strong> defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true</p> <p><strong># Disable Safari’s thumbnail cache for History and Top Sites</strong> defaults write com.apple.Safari DebugSnapshotsUpdatePolicy -int 2</p> <p><strong># Enable Safari’s debug menu</strong> defaults write com.apple.Safari IncludeDebugMenu -bool true</p> <p><strong># Remove useless icons from Safari’s bookmarks bar</strong> defaults write com.apple.Safari ProxiesInBookmarksBar “()”</p> <p><strong># Disable send and reply animations in Mail.app</strong> defaults write com.apple.Mail DisableReplyAnimations -bool true defaults write com.apple.Mail DisableSendAnimations -bool true</p> <p><strong># Disable Resume system-wide</strong> defaults write NSGlobalDomain NSQuitAlwaysKeepsWindows -bool false</p> <p><strong># Enable Dashboard dev mode (allows keeping widgets on the desktop)</strong> defaults write com.apple.dashboard devmode -bool true</p> <p><strong># Reset Launchpad</strong> rm ~/Library/Application Support/Dock/*.db</p> <p><strong># Show the ~/Library folder</strong> chflags nohidden ~/Library</p> <p><strong># Disable local Time Machine backups</strong> sudo tmutil disablelocal</p> <p><strong># Kill affected applications</strong> for app in Safari Finder Dock Mail; do killall “$app”; done</p> <p><strong># Fix for the ancient UTF-8 bug in QuickLook (http://mths.be/bbo)</strong> echo “0×08000100:0″ > ~/.CFUserTextEncoding</p></blockquote> <p>If you’re making manual changes, many of these will require either the Finder, Dock, or other applications to be relaunched before they are activated. This is generally handled through the script with the second to last command (“Kill affected applications”) but with so many changes being made, it may be easier to just reboot your Mac to insure everything is working properly.</p> <p><em>Thanks to Brian for sending this in!</em></p> </div> <p><a href="http://feedads.g.doubleclick.net/~a/hueaF_pRFY10AVI-eXPnF20h3EM/0/da"><img src="http://feedads.g.doubleclick.net/~a/hueaF_pRFY10AVI-eXPnF20h3EM/0/di" border="0" ismap="true"></img></a><br/> <a href="http://feedads.g.doubleclick.net/~a/hueaF_pRFY10AVI-eXPnF20h3EM/1/da"><img src="http://feedads.g.doubleclick.net/~a/hueaF_pRFY10AVI-eXPnF20h3EM/1/di" border="0" ismap="true"></img></a></p><div class="feedflare"> <a href="http://feeds.feedburner.com/~ff/osxdaily?a=UOIyGf3GvyE:jtat9MYBt44:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/osxdaily?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/osxdaily?a=UOIyGf3GvyE:jtat9MYBt44:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/osxdaily?i=UOIyGf3GvyE:jtat9MYBt44:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/osxdaily?a=UOIyGf3GvyE:jtat9MYBt44:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/osxdaily?i=UOIyGf3GvyE:jtat9MYBt44:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/osxdaily?a=UOIyGf3GvyE:jtat9MYBt44:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/osxdaily?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/osxdaily?a=UOIyGf3GvyE:jtat9MYBt44:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/osxdaily?d=qj6IDK7rITs" border="0"></img></a> </div><img src="http://feeds.feedburner.com/~r/osxdaily/~4/UOIyGf3GvyE" height="1" width="1"/> View the full article
Recommended Posts