This isn't your typical blog post. The idea is to collect all the cool and useful code snippets related to Apple macOS (previously known as OS X) operating system that I don't (and assume you won't either) use that often but are super handy when needed. This means this post will be updated overtime. If you know any snippets I've missed, please dm or mention me on Twitter.

fstab

My machine has dual boot setup between macOS (for work and daily use) and Windows 10 (works as a mediacenter / gaming console with Kodi as a frontend.) This means I really don't need to access any Windows partitions from macOS. As a result I like to hide those partitions from finder, permanently. Here comes in a little tool called fstab.

Let's say we wanted to hide all windows partitions from macOS. Commonly Windows has boot partitions called 'System Reserved' (older BIOS based machines) or 'EFI' (UEFI machines, lucky for us this is hidden by default and the main partition which you may know as drive C. In macOS this partition shows up as 'Untitled'.

First we need to get some information about those partitions. Open up your favorite terminal emulator, macOS comes with terminal.app which will do the job fine.

diskutil info /Volumes/Untitled

That should output list of technical details about the partition. What we are after is the 'Volume UUID'. Copy the UUID. Next in terminal we need to create a file named fstab in the system folder 'etc'. For this I'm going to use a terminal based text edutor called nano (Comes with the OS).

sudo nano /etc/fstab

In here we are going to tell the system not to mount certain partitions. If you don't have 'System Reserved' visible in your system you can ignore the second line. Replace the UUID with the one you copied earlier.

UUID=00000000-0000-0000-0000-000000000000 none ntfs rw,noauto
LABEL="System\040Reserved" none ntfs rw,noauto

Dock Spacer

This one is rather handy macOS customization trick for orginizing your pinned apps on your dock.

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

Restart the dock process:

killall dock

After that you can drag that spacer between two apps.