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.

Post sort order: Post Date (Newest First) | Post Date (Oldest First) | Alphabetical | Date Updated

Showing seconds with ls on Linux and OSX

Posted in Linux/Unix/BSD and OSX -

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.

How to shrink a VMWare Fusion Linux virtual disk

Posted in OSX and VMWare -

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.

Create keyboard shortcut to export as PDF in Safari on OS X

Posted in Applications and OSX -

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.

Scroll Lock Key on a Mac

Posted in OSX -

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...

Mac mail queue commands

Posted in OSX -

This post is a quick reference for some of the mail server commands for Apple Mac OSX: how to show the queue, flush it, delete everything, delete a particular message, etc.

How to clear the DNS cache on Mac OSX

Posted in OSX -

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.

Failed to add the host to the list of known hosts

Posted in Linux/Unix/BSD and OSX -

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.

Remap quit and close tab shortcut keys etc in Mac OS X

Posted in OSX -

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).

Change Mac OS X DNS servers from the command line

Posted in OSX -

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.

Disable the screenshot shadow on Mac OS X

Posted in OSX -

When you take screenshots on Mac OS X there's a shadow around the screenshot by default. This post shows how to disable the shadow from the screenshot and how to subsequently restore the shadow.

Free inactive memory on Mac with FreeMemory

Posted in OSX -

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.

How to disable spotlight indexing on Mac OSX

Posted in 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.

Purge all Google Chrome user data on a Mac

Posted in Applications and OSX -

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.

Remove input shadows on iOS devices

Posted in OSX -

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.

Using purge to free inactive memory on Mac OS X

Posted in 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.

Fix "the operation can't be completed because you don't have permission to access some of the items" error on OSX

Posted in OSX and Quick Tips -

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".

OSX Quick Tip: Show all files in the Finder including dot files

Posted in OSX and Quick Tips -

The default behavior of the Finder on OSX is to hide UNIX files such as /usr /var etc and dot files (e.g. .htaccess). This quick tip shows how to enable (or disable) showing these files.