More .osx suggestions? #5

Open
mathiasbynens opened this Issue Sep 6, 2011 · 27 comments

Projects

None yet

10 participants

@mathiasbynens

http://superuser.com/questions/11026/textmate-creates-temporary-files-and-doesnt-delete-them

defaults write com.macromates.textmate OakDocumentDisableFSMetaData 1
@volsk

Great work! Lovin' it.

Maybe not .osx but a suggestion:

quit () {
        for app in $*; do
                osascript -e 'quit app "'$app'"'
        done
}

and

pman() { man -t "${1}" | open -f -a Preview; }
@ghost

Hidden

defaults write -g NSSavePanelStandardDesktopShortcutOnly -bool true # cmd-D, not cmd-delete (10.7)
defaults write -g WebAutomaticDashSubstitutionEnabled -bool false
defaults write -g WebAutomaticTextReplacementEnabled -bool false
defaults write -g WebContinuousSpellCheckingEnabled -bool false
defaults write com.apple.CrashReporter DialogType none
defaults write com.apple.Safari NSQuitAlwaysKeepsWindows -bool true #* enable Resume per application
defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool true
defaults write com.apple.dashboard mcx-disabled -bool true # disable Dashboard
defaults write com.apple.helpviewer NormalWindow -bool true # not always on top
defaults write com.apple.iTunes hide-ping-dropdown -bool true #* oblong buttons that appear on song lists
defaults write com.apple.spotlight DictionaryLookupEnabled -bool false # disable Dictionary results
# Already included in .osx
defaults write com.apple.finder QuitMenuItem -bool true
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
defaults write com.apple.frameworks.diskimages skip-verify -bool true # don't verify mounted DMGs

Not hidden

defaults write -g AppleEnableSwipeNavigateWithScrolls -bool false # Swipe between pages
defaults write -g InitialKeyRepeat -int 15 # in milliseconds, shortest shown in System Preferences is 15
defaults write -g KeyRepeat -int 2 # fastest shown in System Preferences is 2
defaults write -g com.apple.keyboard.fnState -bool true # Use all F1, F2, etc. keys as standard function keys
defaults write -g userMenuExtraStyle -int 2 # Show fast user switching menu as: icon
# Already included in .osx
defaults write com.apple.finder AppleShowAllExtensions -bool true # Show all filename extensions
@mathiasbynens

Woah, thanks @Lri! Will go over these and cherry-pick.

I noticed AppleShowAllExtensions is not in the com.apple.finder domain (at least not on Lion). Looks like it should be defaults write NSGlobalDomain AppleShowAllExtensions -bool true.

@necolas

Is there an option to automatically enable snap-to-grid on desktop icons?

@mathiasbynens

@necolas Added in dda45e2.

FWIW, this is how I find the correct keys:

  1. defaults read > a
  2. Change the setting
  3. defaults read > b
  4. diff a b

If that doesn’t work, I usually try to run strings on the binary and look for anything that resembles a preference name.

(There might be a better way, so please let me know if I’m being silly!)

Update: Lauri Ranta shares some more tricks on how to discover hidden preferences: http://osxnotes.net/defaults.html


Unfortunately, in this case it’s a list and not a simple property, so we can’t just use defaults write. PlistBuddy to the rescue!

# Enable snap-to-grid for desktop icons
/usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist

Thanks for the suggestion, I should’ve added this one sooner.

@necolas

Awesome, thanks. Been looking for this one.

@ghost

A few more hidden preferences that aren't currently included in .osx and I didn't mention before.

# Display ASCII control characters using caret notation in standard text views
defaults write -g NSTextShowsControlCharacters -bool true

# Add a context menu item for showing the web inspector to web views
defaults write -g WebKitDeveloperExtras -bool true

# Disable the animation for showing and hiding information panels in Finder
defaults write com.apple.finder AnimateInfoPanes -bool false

# Don't open a Finder window when mounting an external disk
defaults write com.apple.finder OpenWindowForNewRemovableDisk -bool false

# Make Safari's search banners default to Contains instead of Starts With
defaults write com.apple.Safari FindOnPageMatchesWordStartsOnly -bool false
@mathiasbynens mathiasbynens added a commit that referenced this issue Feb 24, 2012
@mathiasbynens .osx: Tweak some more hidden preferences
Thanks to @Lri! Ref. #5.
4c0198f
@mathiasbynens

Thanks, @Lri!

@3vincent
External drives remain mounted after logout / externel drives are mounted before first login (works for 10.6+)
$ sudo defaults write /Library/Preferences/SystemConfiguration/autodiskmount AutomountDisksWithoutUserLogin -bool true

Address Book Debug Menu
$ defaults write com.apple.addressbook ABShowDebugMenu -bool YES

iCal Debug Menu
$ defaults write com.apple.iCal IncludeDebugMenu YES

Time Machine: Support for unsupported Network Volumes 
$ defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1

Time Machine: Change Interval of Backups (1800 = 1800 seconds)  
$ sudo defaults write /System/Library/LaunchDaemons/com.apple.backupd-auto StartInterval -int 1800

Set Limit Of Safari History Elements to a NUMBER
$ defaults write com.apple.Safari WebKitHistoryItemLimit 2000

Set Limit Of Safari History Elements to a Number of DAYS
$ defaults write com.apple.Safari WebKitHistoryAgeInDaysLimit 30
@mathiasbynens

Thanks, @3vincent! I’ve enabled the iCal and Address Book debug menus. The other settings are interesting too, but I personally don’t need them — good thing you’ve posted them here for other people to learn though! Thanks again.

@mathiasbynens

@necolas pointed me to http://poller.se/2010/08/optimizing-mac-os-x-for-ssd-drives/ — some of the listed commands have been proposed here before. I should consider adding them to .osx in commented form anyway, so it’s easier for other people to use.

@mathiasbynens

Here are some more: http://www.johnkastler.net/2011/12/25/os-x-defaults/ Also note that stuff like -string "NO" can in some (?) cases be written as -bool false instead (which makes more sense, IMHO).

@necolas

Needs more inline comments!

@mathiasbynens

@necolas Don’t worry, I’ll take care of that :)

@aristidesfl

It would be useful to have a separate repository only with osx stuff which could be included in everyone's dotfiles

@mathiasbynens

@aristidesfl But it’s just a single file. I don’t see how anyone would benefit from having a separate repository.

@aristidesfl

@mathiasbynens

The idea would be to keep a repository with a central impartial collection of potentially useful Max OS X settings. This would become the place of reference for this kind of settings, and everyone could make pull requests with the new additions without affecting your personal preferencies.

This would potentially allow people to fork the repo on github; create a branch to keep only the preferences they would like to see applied in their system ((un)commenting); and include that customized branch in their own dotfile repo via submodule/subtree.

This way, you could include in your dotfiles a customized branch of the collection with only the preferences which interest you. If someone doesn't want to use git to include the file they can still just copy or execute it directly from github.

Advantages

  • Having a more impartial and uncompromised collection, independently of a single user's preferences.
  • Be able to include the collection in each individual's dotfile repository without having to include all sort of unrelated files.
  • Be able to keep the included collection up to date while maintaining personal preferences using a VCS (git in this case).

Other details

  • There could exist an index of all settings in the beginning of the file
  • There could exist a reset file the same settings but with the default OS X values and/or a backup/restore script like discussed in issue #58
@telemachus
# Remove scroll bouncing
defaults write -g NSScrollViewRubberbanding -int 0
@mathiasbynens

@telemachus That’s a nice touch. Unfortunately it only seems to actually remove the scroll bouncing effect in a few apps such as Finder. Safari, for example, still has it. :(

@wamatt

Out of interest, any reason imagemagick included, but commented out by default?

IE what significance or meaning does that have (if any).

oops - sorry that should be in the .brew suggestions

@mathiasbynens

I don’t want to install imagemagick by default on all the machines I work on, only on my own laptop. Listed it in .brew is like a reminder to me — “hey, you might want this too. Or not.” (For the same reason, some .osx commands have been included in commented out form.)

@wamatt

OK thought it was something like that (:

@fin1te fin1te pushed a commit that referenced this issue Aug 21, 2012
@mathiasbynens .osx: Tweak some more hidden preferences
Thanks to @Lri! Ref. #5.
dea1f7d
@Gudahtt Gudahtt pushed a commit to Gudahtt/dotfiles that referenced this issue Mar 18, 2013
@icco icco cloudapp should fail gracefully if a file isn't specified
closes #5
7ac291a
@gamelinchpin gamelinchpin pushed a commit to gamelinchpin/dotfiles that referenced this issue Sep 12, 2013
@mathiasbynens .osx: Enable snap-to-grid for desktop icons
Ref. #5
c07291c
@gamelinchpin gamelinchpin pushed a commit to gamelinchpin/dotfiles that referenced this issue Sep 12, 2013
@mathiasbynens .osx: Enable snap-to-grid for desktop icons
Ref. #5
5895a63
@gamelinchpin gamelinchpin pushed a commit to gamelinchpin/dotfiles that referenced this issue Sep 12, 2013
@mathiasbynens .osx: Tweak some more hidden preferences
Thanks to @Lri! Ref. #5.
e40ad84
@gamelinchpin gamelinchpin pushed a commit to gamelinchpin/dotfiles that referenced this issue Sep 12, 2013
@mathiasbynens .osx: Tweak some more hidden preferences
Thanks to @Lri! Ref. #5.
36d6e0f
@gamelinchpin gamelinchpin pushed a commit to gamelinchpin/dotfiles that referenced this issue Sep 12, 2013
@mathiasbynens .osx: Enable the debug menu in iCal and Address Book
Thanks to @3vincent. See issue #5: mathiasbynens#5 (comment)
b1b3007
@gamelinchpin gamelinchpin pushed a commit to gamelinchpin/dotfiles that referenced this issue Sep 12, 2013
@mathiasbynens .osx: Enable the debug menu in iCal and Address Book
Thanks to @3vincent. See issue #5: mathiasbynens#5 (comment)
da81aba
@mathiasbynens

FWIW, @pornel suggested to look into dtrace. From https://twitter.com/pornelski/status/392985675584516096:

I haven't played with dtrace yet, but AFAIK you can intercept method calls, so you could log every preference read.

@nicksen nicksen pushed a commit to nicksen/osx_dotfiles that referenced this issue Oct 30, 2013
@mathiasbynens Show all filename extensions in Finder. (Can be set via Finder → Pref…
…erences too.)


Thanks for the pointer, @Lri! mathiasbynens/dotfiles#5 (comment)
e00f487
@seandw seandw pushed a commit that referenced this issue Nov 17, 2013
@mathiasbynens Show all filename extensions in Finder. (Can be set via Finder → Pref…
…erences too.)


Thanks for the pointer, @Lri! #5 (comment)
0b04ff4
@mathiasbynens

Some more goodies: amlweems/tilde@8f92281

@niksy niksy referenced this issue in niksy/dotfiles Dec 23, 2013
Closed

Review existing dotfiles for new additions #6

@kevinSuttle

Just a heads up to anyone subscribed to this thread: https://github.com/kevinSuttle/OSXDefaults/blob/master/REFERENCE.md

@pornel

@mathiasbynens Re: dtrace http://pastebin.com/QRbJQs5M

#!/usr/sbin/dtrace -q -s


CFPreferencesServer$target:::request {
   printf("REQUEST from pid %d at %Y ( domain: %s, user: %s, host: %s, container: %s, managed: %d)\n", arg0, walltimestamp, copyinstr(arg1), copyinstr(arg2), copyinstr(arg3), copyinstr(arg4), arg5);
}

CFPreferencesServer$target:::write_rejected {
   printf("REJECTED WRITE request from pid %d for reason %s at %Y ( domain: %s, user: %s, host: %s, container: %s)\n", arg0, copyinstr(arg5), walltimestamp, copyinstr(arg1), copyinstr(arg2), copyinstr(arg3), copyinstr(arg4));
}

CFPreferencesServer$target:::write {
   printf("ACCEPTED WRITE from pid %d at %Y ( domain: %s, user: %s, host: %s, container: %s)\n", arg0, walltimestamp, copyinstr(arg1), copyinstr(arg2), copyinstr(arg3), copyinstr(arg4));
}

/*
CFPreferencesServer$target:::cache_miss {
   printf("CACHE MISS from pid %d at %Y ( domain: %s, user: %s, host: %s, container: %s, managed: %d)\n", arg0, walltimestamp, copyinstr(arg1), copyinstr(arg2), copyinstr(arg3), copyinstr(arg4), arg5);
}
*/

CFPreferencesServer$target:::read_rejected {
   printf("REJECTED READ request from pid %d for reason %s at %Y ( domain: %s, user: %s, host: %s, container: %s, managed: %d)\n", arg0, copyinstr(arg6), walltimestamp, copyinstr(arg1), copyinstr(arg2), copyinstr(arg3), copyinstr(arg4), arg5);
}

CFPreferencesServer$target:::read {
   printf("ACCEPTED READ from pid %d at %Y ( domain: %s, user: %s, host: %s, container: %s, managed: %d)\n", arg0, walltimestamp, copyinstr(arg1), copyinstr(arg2), copyinstr(arg3), copyinstr(arg4), arg5);
}

CFPreferencesServer$target:::persist {
    printf("SAVING %s TO DISK at %Y\n", copyinstr(arg0), walltimestamp);
}

CFPreferencesServer$target:::error {
    printf("ERROR %s at %Y\n", copyinstr(arg0), walltimestamp);
}

BEGIN
{
    printf("Monitoring cfprefsd instance %d\n\n", $target);
}
@mathiasbynens mathiasbynens referenced this issue in kevinSuttle/MacOS-Defaults Jan 13, 2014
Open

Implement dtrace #4

@MaksymDev MaksymDev pushed a commit that referenced this issue Dec 14, 2014
@tpope tpope Concede 'list'
Closes #5.
7ad81be
@mathiasbynens mathiasbynens referenced this issue Feb 20, 2015
@mathiasbynens .osx: Add back the “increase window resize speed” hack
It didn’t work in OS X 10.10 anymore, but it seems OS X 10.10.1 does support it.

Ref. 4471e27.
7197c57
@dmcass dmcass pushed a commit to dmcass/windows-dotfiles that referenced this issue Mar 10, 2015
@mathiasbynens Show all filename extensions in Finder. (Can be set via Finder → Pref…
…erences too.)

Thanks for the pointer, @Lri! mathiasbynens#5 (comment)
3da5965
@dmcass dmcass pushed a commit to dmcass/windows-dotfiles that referenced this issue Mar 10, 2015
@mathiasbynens .osx: Enable snap-to-grid for desktop icons
Ref. #5
5c72af5
@dmcass dmcass pushed a commit to dmcass/windows-dotfiles that referenced this issue Mar 10, 2015
@mathiasbynens .osx: Tweak some more hidden preferences
Thanks to @Lri! Ref. #5.
6470195
@dmcass dmcass pushed a commit to dmcass/windows-dotfiles that referenced this issue Mar 10, 2015
@mathiasbynens .osx: Enable the debug menu in iCal and Address Book
Thanks to @3vincent. See issue #5: mathiasbynens#5 (comment)
273ddd7
@mlowery mlowery added a commit that referenced this issue Jun 2, 2015
@mlowery mlowery reorg #5 60ed66a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment