OSX Yosemite

OSX Yosemite is a great and beautiful designed operating system. Has been running Yosemite for several months, I’ve written up some notes related to it. Some of the tips probably also applicable for other OSX versions.

TimeMachine

TimeMachine is convenient way for having backup to external drives so you don’t have to worry about losing your data anymore. When you’re activating TimeMachine backup, by default it’s also activating a “local snapshots”.

Local snapshots is a local copy of your backup when your backup drive isn’t available. Using this way, you can easily recover or revert to your previous file without needed to attach your backup drive. Pretty neat for portable usage.

Local snapshots is located on .MobileBackups on your drive root. You can’t see it from Finder, but you can see it by using Terminal by typing: ls -la /.

While this won’t eat your local drive because of its ability to calculate the reasonable margin by removing old backups when you have less than 20% of free space, sometimes you feel that this local snapshots eat too much storage.

Disable TimeMachine local snapshots

TimeMachine local snapshots will be disabled automatically when you turn of the TimeMachine. If you want to disable it manually you can do:

$ sudo tmutil disablelocal

To manually reactivate it, you can use:

$ sudo tmutil enablelocal

Remove TimeMachine backup

Removing TimeMachine backup manually can be done by using tmutil command. It’s as simply as:

$ sudo tmutil delete /Volumes/BUFFALO/Backups.backupdb/Yosemite/2015-05-27-140718

Screenshots

OSX has handy shortcuts for taking screenshots. By default it will store the screenshots to Desktop. For changing the location we can use:

$ defaults write com.apple.screencapture location ~/Pictures/Screenshots/

Logout or if you want to make this changes has immediately effect you can do:

$ killall SystemUIServer

Now every time you take a screenshot, it will be stored on folder ~/Pictures/Screenshots.

Default folders

There are some folders on your home directory which can’t be deleted. It will show you an error “[Folder Name]” can’t be modified or deleted because it’s required by OS X. when you try.

This is happen because OSX add many enhancements to standard UNIX for managing files. The addition that responsible for the restriction is ACL.

ACL (Access Control List)

For getting better understanding why default folders can’t be deleted, you can use:

$ ls -le
drwx------+  7 subosito  staff   238 May 27 14:27 Pictures
 0: group:everyone deny delete

There is flag + for Pictures. This means that there is an ACL for that folder. Each rule in an ACL called ACE (Access Control Entry). For the Pictures folder above, there is one ACE that can be translated as “the Pictures folder is protected for being deleted from everyone including the owner (You)”. Yosemite expect the folder to be always present.

For removing the ACL flag, you can use chmod. For removing you can pass -a like:

$ chmod -a "group:everyone deny delete" Pictures

Now you can see the updated output:

$ ls -le
drwx------   7 subosito  staff   238 May 27 14:27 Pictures

For adding the ACL back you can pass +a like:

$ chmod +a "group:everyone deny delete" Pictures

By the way, it’s safer to keep all default folders in place, unless there is a reason that force you to remove the folders.

File Flags

File flags is extended attributes for the file/folder. It’s marked as @. See below:

$ ls -lO
drwx------@ 63 subosito  staff  hidden 2142 May 27 15:33 Library

The Library folder has flag hidden, which means this won’t show up in Finder window. This flag is added by using chflags command, like:

$ chflags hidden Library

To remove the flag you can append no to the flag name:

$ chflags nohidden Library

There are some flags available to use, you can see them on man chflags.