Hacker News new | past | comments | ask | show | jobs | submit login
OSX For Hackers (gist.github.com)
469 points by zackattack on Mar 31, 2012 | hide | past | web | favorite | 117 comments



This seems to be a copy of Mathias Bynen's Dotfiles (https://github.com/mathiasbynens/dotfiles/blob/master/.osx, 'sensible hacker defaults for OS X'), with a few minor changes. Specifically, comments explainung each line have been changed to echo statements, and the following lines have been inserted:

  echo "Use current directory as default search scope in Finder"
  defaults write com.apple.finder FXDefaultSearchScope -string "SCcf"

  echo "Show Path bar in Finder"
  defaults write com.apple.finder ShowPathbar -bool true

  echo "Show Status bar in Finder"
  defaults write com.apple.finder ShowStatusBar -bool true

  echo "Set a shorter Delay until key repeat"
  defaults write NSGlobalDomain InitialKeyRepeat -int 12

Also, some commands have been commented out:

  # Automatically hide and show the Dock
  # defaults write com.apple.dock autohide -bool true

  # Show remaining battery time; hide percentage
  # defaults write com.apple.menuextra.battery ShowPercent -string "NO"
  # defaults write com.apple.menuextra.battery ShowTime -string "YES"

  # echo "Always show scrollbars"
  # defaults write NSGlobalDomain AppleShowScrollBars -string "Auto"

  # Disable window animations and Get Info animations in Finder
  # defaults write com.apple.finder DisableAllAnimations -bool true

  # Don’t animate opening applications from the Dock
  # defaults write com.apple.dock launchanim -bool false

  # Disable opening and closing window animations
  # defaults write NSGlobalDomain NSAutomaticWindowAnimationsEnabled -bool false

  # Empty Trash securely by default
  # defaults write com.apple.finder EmptyTrashSecurely -bool true

  # Remove useless icons from Safari’s bookmarks bar
  # defaults write com.apple.Safari ProxiesInBookmarksBar "()"

  # Disable send and reply animations in Mail.app
  # defaults write com.apple.Mail DisableReplyAnimations -bool true
  # defaults write com.apple.Mail DisableSendAnimations -bool true

  # Disable Resume system-wide
  # defaults write NSGlobalDomain NSQuitAlwaysKeepsWindows -bool false

  #Fix for the ancient UTF-8 bug in QuickLook (http://mths.be/bbo)
  # Commented out, as this is known to cause problems when saving files in Adobe Illustrator CS5 :(
  #echo "0x08000100:0" > ~/.CFUserTextEncoding


# This is script with usefull tips taken from:

# https://github.com/mathiasbynens/dotfiles/blob/master/.osx


Yeah… But still it’s a bit confusing. It’s almost an exact copy, and no real functionality has been added (except for the four commands jamessb mentioned). I feel like I’m missing something — this is something you would expect to see in a fork, rather than a separate gist.

Oh well, glad to see my dotfiles are of use!


I reckon the original author didn't expect it to get any traffic, and just made it for themselves. Thanks for collating all these anyway!


Yeah, I don't understand why this gist has been created. Just learn from Mathias's dotfiles repo which also has other useful settings.


I don't understand why this gist has been created

Alas, so someone else can take credit for it with plausible deniability.


If you are worried about some of these settings before running them, you can backup your preference files

All that the 'defaults' command does is alter values stored in plist files, which are located in /Library/Preferences (and for the user in ~/Library/Preferences).

You can add something like this to the top of the script:

    echo "Making a backup.."
    tar -pzcf ~/preferences-`date "+%Y%m%d-%H%M%S"`.tgz ~/Library/Preferences /Library/Preferences
You may need to sudo to read some of the machine plist files


This is what I was looking for. Thanks!


Before I saw this gist I had been completely unaware of the fact that Snow Leopard disables subpixel font rendering on non-Apple displays. Font rendering is something that drives me crazy if it's not done right. It's one of my main gripes with Windows (YMMV).

Thanks to the respective hack my Samsung 24" has suddenly become acceptable to work on again. Awesome.


Don't you hate being a font-rendering snob and then realizing you've been staring at something ugly for months without realizing it?

I'm not being snide; it's happened to me. I used to be a typesetter, and yet when I had trouble using Inconsolata in Sublime Text, I reverted back to Menlo, which I hated - and spent the next few months preaching about how hard I'd worked to find the Perfect Programmer Font For Me, not realizing I wasn't actually looking it in the editor. Worse, I was seeing it in Terminal; I had no excuse.

It's the visual equivalent of the classic audio production goof: You spend hours tweaking a particular equalizer setting, everybody agrees that it sounds perfect now, and then realize the EQ hasn't been patched in at all and you've been changing nothing.


I just stopped using the monitor after half an hour of using OS X on it and gave it to my roommate, since I'm hardly ever home anyway. Now it's back on my desk again.

It bugs me that I thought I needed a better screen instead of instantly seeing what's the issue. Especially since I used to play around a lot with the Freetype settings in Ubuntu and should have known what makes the fonts look the way they do.

But then again I trusted Apple to not let this kind of stuff happen.


Font rendering must really drive you crazy if you had not noticed yet that it was off...


See my answer to jaylevitt's posting.


This is totally awesome, however one of the biggest things for me since i've recently bought a mac and coming from linux is the focus follows mouse issue, which i know has been attempted to get working but failed.

Other things i miss are basics like double clicking the title bar to maximise, right clicking to create a new file and a few other things i miss from linux.


I know OSX does a lot of things right, but focus follows mouse and copy-on-select/paste-on-middle-click are two things that I can't live without.


Count me in on missing focus follows mouse too. FWIW, you can get Terminal to support this by:

defaults write com.apple.Terminal FocusFollowsMouse -string YES

Also with XQuartz, you can set X11 windows to focus follows mouse in the Preferences > Window screen.

In addition one thing I've always missed is being able to lower the Z-order of a window to the bottom of the window stack by clicking on the middle (or third) mouse button on the window title bar.


Though neither mode is perfect in all situations, on balance I prefer focus-follows-mouse.

I do NOT care for copy-on-select, I like copy to be an explicit action. That way I can select, copy, select, paste to replace. With copy-on-select, you have to select, paste, select, delete which is less natural for me.


copy-on-select is great as long as the other clipboard still exists too (this is typically the case in linux). What is the downside, if you can still ctrl-c/ctrl-v to a separate clipboard?


Terminal emulators that rely only on copy-on-select to copy terminal text.


You can have both of these in iterm2. There are also copy-on-select plugins for browsers.

Just got my Mac. I am trying to figure out how to efficiently run a Linux virtual machine.


Take a look at Vagrant (http://vagrantup.com). It's a command line driver and library manager for VirtualBox VMs. It's integrated with Chef and Puppet if automated provisioning is your thing.


I am. It is ridiculously slow. But I realized it is just a networking issue (hitting the host-only network from a browser on my Mac), so hopefully I can fix it.

Edit: Figured it out, DNS issue: sudo apt-get remove libavahi-common3


edit /etc/nsswitch to remove mdns from the list... that takes care of the issue and you can keep avahi for some of the other things it provides (such as automatic discovery of printers, and the likes).


VirtualBox should serve you well.


Completely agreed. This is the one thing holding me back from fully switching from Linux to OS X. They seem like such minor things--it's amazing how big of a difference it makes not having them.


I don't understand what you mean by 'focus follows mouse issue'. Please explain more, maybe there's a solution to that (whatever that issue is!)


On Linux, whenever you hover the mouse over a window, that window has focus. On OS X, you have to click in that window in order for it to gain focus.

Steve Yegge mentioned in a rant[0] a while back.

[0] http://steve-yegge.blogspot.co.uk/2008/04/settling-osx-focus...


You do have to enable this setting in Linux. By default, most Linux distributions behave like Windows and OSX, so folks like me who never used Unix workstations have no way of knowing they're missing out on what I consider one of the key advantages of the Linux desktop. I finally learned about it from Steve Yegge's blog post. Ironically, three years after falling in love with focus-follows-mouse because of Yegge's frustration with OSX, I joined a company that is all OSX on the desktop. Le sigh....


For whatever reason, OS X does work that way for scrolling; while typing this comment I can point at and scroll the window behind this one. Not sure why typing doesn't behave the same, though.


Even more: while holding command key you can click on background windows, or select text in them without them gaining focus.


Been a Mac user for years and did not know this. Thanks!


I see.

I have to say I like OS X's behavior much much more. Directing key strokes to a window that my mouse just happens to point to would be very confusing (to me at least).


In focus follows mouse mode, moving the pointer onto a window gives it focus.


Have you tried using shortcut keys instead of the mouse? I find the more I keep my hands on the keyboard the faster everything becomes.


"OSX for Hackers" would have a real tiling window manager.


It doesn't compare to using something like i3, but size up 2 makes it a little less painful.


Along the same lines I am enjoying http://manytricks.com/moom/


my biggest gripe with mac os having recently moved from windows is hitting the maximise button on finder and it barely filling half the screen.

other well documented one is the ability to turn the laptop screen of when using another screen but still the laptop keyboard


Hold Shift while hitting the green plus ("resize window") button to make it maximise the window.


Holy crap! I wish I could give you multiple upvotes for this. I wonder if there's a way to make this the default? This reminds me that I really need to spend a couple of days delving into basic OSX functionality (features/keyboard shortcuts). There are probably a ton of other features like this that I'm oblivious to.


Cheers for that, I've been mildly annoyed with the resize button for years but never enough to look for a solution. This works great.


still, doesn't work for me! what version are you using?


Using Lion, but I recall doing this for some time (Tiger?); I may be wrong. Do you have tap to click enabled?


IIRC it was introduced fairly recently, either Snow Leopard or Lion.


It is app-dependent too.


Holy crap part 2. I've been looking for that for a long time!


There is no maximize button in OS X; there's a zoom button. It's used to toggle between a window's "standard" size and position, and a user-defined size and position.

http://developer.apple.com/library/mac/#documentation/UserEx...

Your application determines the initial size and position of a window, which is called the standard state. If the user changes a window's size or location by at least 7 points, the new size and location is the called the user state. The user can toggle between the standard state and the user state by clicking the zoom button in the title bar.


Call it what you like, it's still confusing, and pointing users to documentation is not going to solve the problem.


It's not confusing, it does the exact same thing it's always done since the 1980s. The zoom button in Windows is horribly broken though - all it ever does is make the window fill the whole screen! How wasteful!...

Considering the number of complaints though, you'd think Apple would introduce a preference setting, or another button or something. And in fact they have - in 10.7 there's a maximize button in the top right corner...

Except the new button is officially called the "fullscreen" button and to hear some people talk, the existence of the fullscreen mode is a foreboding sign of the coming iPad-ification of OS X...

sigh.


Apple is seen as a company that cares about simplicity and user experience. If a feature is confusing to many, mostly because the behavior depends on application and window size, we should expect them to refine it. Claiming that such users are "wrong" because it works fine for somebody who has used Mac for the last 20 years completely misses the point.


One is not more simple than the other. People complain just because the behavior is different from Windows, which is what they are used to.


I use divvy to manage my window sizing. Check it out - there's a free never-ending demo version too.


ShiftIt is a great open source alternative for window managing in OSX as well.

https://github.com/fikovnik/ShiftIt


You can "fix" this by installing Moom http://manytricks.com/moom/


Moom is great. Having to use a pointing device to manipulate windows is silly. It kind of sucks to pay $5 to get features that really should be part of the OS, but the end result is good.

Shortcuts that I can't live without: Cmd+Shift+Up = Maximize. Cmd+Shift+Left = Move to Left Display (my big monitor). Cmd+Shift+Right = Move to Right Display (my laptop monitor). Cmd+Shift+PgUp/PgDown = Move to top/bottom of screen. Etc, etc.


Divvy is also equally awesome. http://mizage.com/divvy/


I've been usign Moom for about a month now and I can't count the number of times it's saved me from my old gripe with the 'zoom' button.


I use SizeUp for this.

http://www.irradiatedsoftware.com/sizeup/

you can set the keyboard shortcut to maximize the window, or split it left/right like you can in Windows 7. The trial is pretty good, you get a windows to click away everytime the app starts but that's usually it.


There's a free utility called "RightZoom" that fixes this -- it works perfectly for me (on 10.5 and 10.6 -- haven't upgraded to Lion yet).


You'll probably get used to the maximise button. It will expand the window to fit the content. If you realy want fullscreen, use the fullscreen button. I usually have Safari in fullscreen all day. One three finger swipe to swap between desktop and Safari.


Moom is your friend http://manytricks.com/moom/


I just use secrets. It was found here. http://secrets.blacktree.com/

I'm not sure why the site is down. But I mirrored it here. http://stfudamnit.com/ryan/Secrets.prefPane.zip


Sadly, Secrets is a bit outdated. Lots of useful hidden tweaks aren’t listed there.


Still waiting for a god damned "disable swoosh effect" defaults key for switching between desktops as you could in snow leopard.


If you mean how slow mission control is it's this one: defaults write com.apple.dock expose-animation-duration -int 0; killall Dock


Nah, not that one but that's good too.


A 2D dock is what hackers need? Is this really for hackers or just someone's personal preference?


I honestly don't have a preference on the eye candy present in most operating systems, but I do know that I dislike the agonizing wait introduced to open a new window, watching it's open animation progress frame by frame after I've put my workstation under _Heavy_ load. Removing a lot of the visual fluff can help keep someone productive, even when their machine isn't being the most responsive.

It's entirely preference, dependent on the specs of the workstation and the user's ability to open a couple hundred web browser tabs, 5 VMs, and 2 different O(log n) sorting operations on some database all at once while still maintaing a Skype conversation with a co-worker.


Great list of modifications. I believe Deeper for OS X has many of these tweaks bundled into a nice interface.

http://www.titanium.free.fr/download.php


For me, the biggest problem with OS X is the command key / meta key situation. I have an impossible time going between Linux, Windows and Mac because of this. Any hacks people know of for this?


Go to System Preferences > Keyboard > Modifier Keys... and configure them however you want.


Not quite however you want. It doesn't work the way it does in Linux where you can rebind keys in arbitrary ways. The built-in modification only enables a few different common/popular rebindings, but from my brief stint with OS X, I found it maddening that I couldn't get the rebinding exactly as I wanted it.


Hm, I feel like I've tried this and couldn't get the behaviors I wanted. How does this accomplish e.g. overloading control-C to copy across the system? You wouldn't want to map command to control, since you still want control-C to be control-C in a shell. Know what I mean?


I use Keyboard Maestro to remap ctrl-X/C/V to copy/paste everywhere except Terminal/iTerm. Same for Chrome so that the Ctrl shortcuts from Linux work on OSX as well.


Sweet! I'll give it a try.


Does changing every single default really make you feel better about yourself?

At least one of these changes (disabling local backups) doesn't even increase performance. Unless you just like data loss.


and now my osx is like my emacs - nobody can use it except me, and i can't even keep my configuration straight across all my machines.


Put your config files in your favorite online vcs (private repo or encrypted if you must).


It seems down right now, but there was a nice database of secret preferences at http://secrets.blacktree.com/ and included a Preference Pane to access them.


I through together a (rough) Cocoa version: https://github.com/dave-gallagher/OSX-For-Cocoa-Hackers

Binary: https://github.com/downloads/dave-gallagher/OSX-For-Cocoa-Ha...

    git clone git@github.com:dave-gallagher/OSX-For-Cocoa-Hackers.git
It's not as robust as the script, but it lets you choose individually what setting you want changed, and also added defaults.


I'm still waiting for the "Quit asking me to retype my password every time I try to do anything" setting. You'd think that the fact I typed it in 30 seconds ago when I logged in would be sufficient proof that I'm me.

This is the type of security that actually leads to less security. Eventually I'll get so sick of not being able to hit the back button on my browser (or whatever similarly impactful action that OSX decides is going to destroy my machine) without special one-time-only admin privileges that I'll just remove the password from my account altogether.


Sounds like you need to fix some Keychain Access settings. Grasping at Internet straws, but perhaps something like this will help?

https://discussions.apple.com/thread/2108355?start=0&tst...

(Fair warning, I'm presuming the back button of which you speak is a Safari back button. I have not experienced this problem myself and I have full-disk encryption on, which requires you to enter a password for most anything.)


This is quite possibly the case. OS X doesn't normally ask for your password once you're logged in except when you're doing something that will affect multiple users (e.g. updating the system). The big exception is when it has somehow lost your keychain password, in which case it will ask for your password every time it needs to look at the keychain.


How often do you come across the need to type in your password? Personally, I do not have to do that too often, and when I have to it usually makes sense to re-authenticate.


If you're getting a password request when you hit the back button, you've got some funky browser plugins.


If you're looking for "Alt-Tab" style window switching on OS X, the best thing I've found is Witch (http://manytricks.com/witch/)

"Alt-Tab" switches between windows in the order you last focused each window, so it's ideally suited to a stack-based workflow where you may have many windows open but are only using a few of them. OS X already has "Command-Tab", but that switches between applications, not windows.


Try Cmd+Tilde.


Your changes to the dock are nothing short of spectacular. Thanks for this! Simple, easy to install, and in accordance with the hacker ethic.


> MacBook:~ ralf$ defaults write enable-spring-load-actions-on-all-items -bool true

Okay. Now just to check…

> MacBook:~ ralf$ defaults read com.apple.dock enable-spring-load-actions-on-all-items 2012-03-31 12:46:35.173 defaults[33945:707] The domain/default pair of (/Users/ralf/Library/Preferences/com.apple.dock.plist, enable-spring-load-actions-on-all-items) does not exist

Hm?


That should probably be

    defaults write com.apple.dock enable-spring-load-actions-on-all-items -bool true


Replace Snow Leopard Exposé (terrible) with old Leopard-style Exposé (amazing).

http://superuser.com/questions/118424/old-leopard-expose-on-...

Unfortunately it won't help those of you who have "upgraded" to Lion...


OK, any of these "bad"?


They're largely harmless. Some of them seem pointless or purely resisting-change, like disabling menu bar transparency. Subpixel font rendering could look pretty bad on the wrong screen.

A lot of those Finder options are just going to increase noise on the screen. It's rare that I ever need to know the full path of something in OS X. Either I'm already on the command line, or I just use Spotlight.

Disabling the “Are you sure you want to open this application?” dialog seems just wrong. Confirming once per program downloaded from the net seems like a sane default.

Anyway these are pretty subjective things. Good thing they're so easy to pick and choose from and revert.


Subpixel font rendering being disabled by default caused text to appear absolutely horrible on my brand new 23' IPS display.

Can you provide an example of an external display on which it's not necessary or harmful?


A projector.


> It's rare that I ever need to know the full path of something in OS X. Either I'm already on the command line, or I just use Spotlight.

I will never understand this.


Disabling the quarantine on executables downloaded from the internet strikes me as a bad idea, but that's just me.

The quarantine is the bit that causes a dialog to pop up the first time you attempt to open a file newly downloaded from the internet that has the executable bit set. Good for catching, say, executables disguised as documents, or stopping anything from exploiting a browser hole to get an executable downloaded to your machine and opened by your browser.


enables tap to click, which you may not like - personally i loathe it.


It's useful for when the physical clicking mechanism on Apple's trackpads eventually die. Though you still need a mouse to drag/draw things.


You can drag windows by double tapping the titlebar, then dragging.


or just enable drag with three fingers in the trackpad preference panel.


I think "Map bottom right Trackpad corner to right-click" is annoying. And I'm not sure why you'd want "Remove Dropbox’s green checkmark icons in Finder"?

Other than that, looks great :)


Here’s my reasoning: I assume all files in my Dropbox get synced correctly; if something goes wrong, I’ll be able to tell by the red warning icon anyway. Why would I want the green checkmark icons? They only add visual noise.


@tubbo That’s still possible when the green icons are hidden: no icon means it’s synced successfully.


For larger datasets, such as Logic Pro projects, you can tell exactly which files have been synced so you don't accidentally open up/save and corrupt your projects.


Agreed. Ctrl-Click works on the rare occasion that you want to right click in an OS X app.


I use the two finger click.


Or just two-finger click.


Upon quick glance, nope everything seems fine.


Why would one disable Time Machine logal backups?


Great tips. Thanks for sharing. I did everything except the track pad right click hack and removing the top bar transparency.


I am surprised that this article made the front page.


Me too, given that the original (http://mths.be/osx) made the front page 200 days ago: https://news.ycombinator.com/item?id=2974911


For OS X I love TotalFinder - better finder.


thank you so much for sharing!


for hackers? LOL.


Ah, i don't have enough money to buy Apple stuffs, can't be hackeer :(




Applications are open for YC Summer 2019

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: