OS X hacks 16-Nov-2015 4:42 PM
Edit FancyEdit New New Blog Upload All Recent Home Logout

Table Of Contents


1. Get the OS X version number from CLI

Find out the OS X version number from the command line:


defaults read loginwindow SystemVersionStampAsString


 grep ProductVersion 
 awk '{print $2}'

2. Add spacers to the dock

Add a space to the left side (apps)

defaults write com.apple.dock persistent-apps -array-add '{tile-data={}; tile-type="spacer-tile";}'

Add a space to the right side (docs)

defaults write com.apple.dock persistent-others -array-add '{tile-data={}; tile-type="spacer-tile";}'

Then, to make it take effect

killall Dock


3. Disable Spotlight

From this hint (modified)

  1. disable spotlight auto-launching
    1. edit /etc/hostconfig
    2. change "SPOTLIGHT=-YES-" to "SPOTLIGHT=-NO-"
  2. turn off indexing and erase the index
    1. mdutil -i off /
    2. mdutil -E /

To turn it back on:

  1. mdutil -i on /
  2. In etc/hostconfig change the NO back to YES

Next, eliminate it from the title bar:


4. SSD Tweaks

  1. Disable Sudden Motion Sensor

    sudo pmset -a sms 0
  2. Disable hibernate image

    sudo pmset -a hibernatemode 0
    sudo rm /private/var/vm/sleepimage
  3. noatime hack

  4. System Preferences - Energy Saver - don't put hard disks to sleep.

Check some settings with: pmset -g


5. Disable Dashboard

  1. turn on dashboard (F12) kill all running items
  2. in terminal: defaults write com.apple.dashboard mcx-disabled -boolean YES
  3. in terminal: killall Dock
  4. right click icon in dock, "remove from dock"


6. Show full paths in finder window titles

    defaults write com.apple.finder _FXShowPosixPathInTitle -bool YES
    killall Finder


7. Smart album of 'unnamed' faces in iPhoto '09

Create a smart album with the criteria:


8. Pinning of the dock

To pin the dock to the left/right/top/bottom instead of the center:

    defaults write com.apple.Dock pinning start ; killall Dock

Valid pinning settings:


9. Search from bash

    goog() {
      open http://google.com/search?q=`echo $* 
 sed -e "s/ /%20/g"`

    wik() {
      open http://en.wikipedia.org/wiki/`echo $* 
 sed -e "s/ /%20/g"`


10. Terminal window resize (bash-iTerm/Terminal script)

echo ^[[8;50;150;t

where "^[" is "escape". Backslashed semicolons are for shell escaping. This sets the terminal it is run in to be (rows,cols) to (50,150).


11. iChat behind a WRT 54g firewall

  1. Find the IP address of the machine.
  2. Set the DMZ to be that IP address.
  3. Start iChat


12. Perl CPAN

Add modules to perl via cpan:

sudo perl -MCPAN -e "shell"

in your .bashrc:

export FTP_PASSIVE=1

then to install:

install Net::Telnet 



13. Sing a little song

say -v bad news do you like cheese do you like cheese do you like cheese do you like cheese do you like cheese do you like cheese do you like cheese do you like cheese do you like cheese do you like cheese do you like cheese


14. rescale an application's everything

for everything:

defaults write -g AppleDisplayScaleFactor 0.5

for a specific app:

defaults write com.apple.SystemPreferences AppleDisplayScaleFactor .5


15. Move OS X's SSH port elsewhere

from this page...

in /etc/services:

myNew-ssh   9999/tcp # new ssh port

in /System/Library/LaunchDaemons/ssh.plist


Then restart "Remote Login" via Sharing preferences.


16. iTunes 9 Zoom Button (+)

Restore the "proper" behavior of the (+) button in iTunes 9.0.1 and higher to maximize the window, like every other app on OS X.

defaults write com.apple.iTunes zoom-to-window -bool YES


17. iTunes Stream Helpers

One of the sites that I use to listen to mp3 streams, does not have their stream's names configured properly, so in iTunes, they all show up with the same name, or a self-similar enough name that it is impossible to tell which is which by just looking at them. Here's what I did to help differentiate them.

  1. Create a playlist for these. You can do a smart playlist (type contains "stream") or a manual playlist that you drop the streams into. Either way works fine.
  2. Put the streams into the playlist. (duh)
  3. cmd-j (ctrl-j) to bring up "View Options"
  4. [x] Episode ID, [OK] -- episode ID is not modified when playing a stream, like the Name or other fields which might change.
  5. Drag the "Episode ID" column in the playlist view over to be next to the "Name" column.
  6. Click in this field for each of the streams, and enter some descriptive text for this stream. "Background Music" or "Requests" etc.

Now, you can just look at that column to know which stream link is which!


18. create a Mavericks install disc

Rather than complicated processes, Apple has provided a tool that lets you create a bootable install media. First, hfs-journaled format a 8+ gig USB disk, named /Volumes/Untitled, then run:

sudo '/Applications/Install OS X Mavericks.app/Contents/Resources/createinstallmedia' --volume '/Volumes/Untitled' --applicationpath '/Applications/Install OS X Mavericks.app' --nointeraction

Here's the OS X El Capitan version:

sudo /Applications/Install OS X El Capitan.app/Contents/Resources/createinstallmedia --volume /Volumes/Untitled --applicationpath /Applications/Install OS X El Capitan.app --nointeraction

It should look pretty similar. ;)


19. Show a message on the OS X Lock/Login screen

Go to preferences, select "Security and Privacy". Unlock padlock in the bottom left. On the General tab, tick the "Show a message when the screen is locked" item, and set the lock message. Use "Option-Enter" to do multiline items.