OSX - alphabetical order

Tips tricks and how tos for using Apple Mac OSX

OSX is Apple's UNIX based operating system and GUI that has been sold since 2002 as a replacement for the classic Mac OS which ended at version 9. This section contains tips and tricks and howtos for using OSX. I have been using OSX as my day to day desktop and development environment since June 2010.

I frequently need to change the DNS servers I use on my Mac and it can be quite a convoluted process to switch them around using the GUI settings. This post shows how quickly you can change between DNS server settings from the command line using terminal.

I frequently export a whole bunch of web pages as PDF documents in Safari on OS X and found it frustrating to have to use the mouse to click click click to do it, and worked out how to create a keyboard shortcut to do it much faster and simply.

I recently reinstalled the operating system on my MacBookPro and discovered when trying to SSH into a new server for the first time I was getting the error "Failed to add the host to the list of known hosts (/Users/chris/.ssh/known_hosts)." This post shows what I needed to do to fix them problem.

I run my webserver and file server from a virtual machine with the files shared using Samba (yes, now that I'm running on OSX I should really share the files with NFS but that's for another day). When trying to copy files from the Mac to the Samba share I was getting the error message "The operation can't be completed because you don't have permission to access some of the items".

I've posted in the past about using the "purge" command line utility on Mac OSX to free up inactive memory but a recent update appears to have broken the tool from working. An alternative is to use the FreeMemory app from the App Store to do the same thing, but more easily.

DNS lookups are cached so that subsequent lookups for the same host don't require querying an external DNS server again until the TTL expires. Sometimes you need to clear the cache, for example if you've changed a DNS record, and this post shows how to do it on Mac OSX.

Spotlight is a useful Mac app for launching apps, finding files and other stuff on your computer, and a whole bunch of other nifty little things. Since upgrading to Lion I've been finding it doing some serious CPU hogging for long periods of time while it updates its index, and because I use very few of the features I decided to switch Spotlight's indexing off.

VMWare Fusion on Mac OSX allows you to shrink virtual disks easily for Windows virtual machines right from the graphical interface (Virtual Machine -> Settings -> General -> Clean Up Virtual Machine) but there isn't the same option to do this with Linux, so you need to do it from the command line.

In Google Chrome you can easily purge browsing data including cookies, history, etc using the application preferences. But there are still a bunch of files that it doesn't touch. I was having some weird issues with my SilverStripe installs (I won't go into that here) which didn't happen when using incognito mode but did under normal browsing. Deleting all browsing data made no difference so I needed to really poke under the hood to delete all data.

I'm the king of hitting random shortcut key combinations and doing unexpected things and often accidentally close a tab or the entire window in Google Chrome while editing some content on one of my websites. Which means having to go back and re-write that content... I'd have enough of that so decided to work out how to remap the Cmd+Q and Cmd+W keys so I could no longer accidentally shut down a tab or window when really meaning to copy n paste or select all (or some other well meaning shortcut).

One thing I've found annoying with the mobile Safari browser on iOS is the shadows that appear at the top of input boxes. It's not normally too much of an issue unless you are doing fancy styling and then they can make it really messy and ugly. Fortunately David Walsh has provided a solution. I won't repeat the solution but do post some screenshots here showing the issue and how much better it can look after applying his fix.

I am the king of random shortcuts and always seem to hit keys when typing that have unexpected consequences, such as this morning when I was doing something in Excel and managed to trigger scroll lock. But there's no scroll lock on a Mac keyboard...

Using the "ls" command to list directory contents from the command line with the -l flag will include the date and time down to the minute, but not show the seconds. This post shows how to display the seconds as well with bash on Linux and OSX.

Apple Mac OS X is generally good at memory management but I sometimes find the inactive memory takes a long time to be released as free memory and my system can grind to a bit of a halt if I need to start up a virtual machine. This post shows how to use the purge command to free up the inactive memory.