Hacks – jozefmares.com
Home Tags Posts tagged with "Hacks"



It really sucks to keep two computers in sync. I am personally not able to keep anything in sync – that’s why I have to always find way how to automate stuff.

So, I have MacBook Air and Hack Pro. Both of computers are in active service (e.g. every day use). Hack Pro is utilised for very serious work which require at least dual-head, Air for creative (coffee shop) and external work. I want them in sync but not in full sync.

In my case there is also issue that Hack Pro have plenty of power to handle all tasks like filtering 10 000 of incoming mails from automated systems, build some of my software, play music with iTunes and even play full-hd video in the same time. On contrary, Air is just road warrior thing. Not so much of power but great portability. Thus, I do not want to do exactly same things on both but there are some essential things like keychain, some app configuration and so on which I want on both of them.


  1. two Macs;
  2. own server / VPS, NAS, whatever;
  3. spare time;
  4. you are not afraid of terminal.

Basically we are going to setup ownCloud, setup sync via Unison and enjoy simpler life.


I talked about Unison before – check it here. It is very cool tool, and if you are user of some sort of Unix OS you really should check it!

When I talked about ownCloud I did not mentioned why I’m setting it up. If there is Unison, why do I need ownCloud? Simple answer – I want web access to data and I am using ownCloud for calendar and contacts synchronisation. Other cool thing is one-click sharing with ownCloud – I’m using it extensively.

Let’s go to terminal. Open your terminal emulator:

mkdir .unison

Start your favourite text editor and go to .unison folder. We are going to create Unison configuration files. I have two profiles: dotfiles and files. These two profiles shares some common configuration.


# Common options for Unison
fastcheck               = true
sortnewfirst            = true
rsrc                    = true
auto                    = true
confirmbigdeletes       = true
silent                  = true

# What to ignore
ignore = Name *~
ignore = Name *.lock
ignore = Name .DS_Store
ignore = Name .tmp
ignore = Name *.swp
ignore = Name *._localized


# Sync roots
root = /Users/$USERNAME
root = ssh://YOUR-USER@YOUR-SERVER//home/USERNAME/TrustedPoint/dotfiles
include common

# What to synchronize
path = .bin
path = .ssh
path = .bashrc
path = .bash_profile
path = .gnupg
path = Library/Application Support/Adium 2.0
path = Library/Keychains/login.keychain
path = Library/Application Support/NetNewsWire

# Ignore these paths
ignore = Path {.gnupg/S.gpg-agent}

# Keep backup copy of every file on server
backuplocation = central
backup = Name *
backupprefix = $VERSION.
backupsuffix =

# Log actions
logfile = /Users/USERNAME/.unison/sync-dotfiles.log


Sync roots
root = /Users/USERNAME
root = ssh://YOUR-USER@YOUR-SERVER//home/USERNAME/TrustedPoint/files
include common

# What to synchronize
path = Documents
path = Downloads

# Ignore these paths
ignore = Path Documents/Virtual Machines.localized

# Keep backup copy of every file on server
backuplocation = central
backup = Name *
backupprefix = $VERSION.
backupsuffix =

# Log actions
logfile = /Users/USERNAME/.unison/sync-files.log

Login via SSH to your server, install Unison (same version as you have on your Mac), create folder structure:

mkdir -p TrustedPoint/files
mkdir -p TrustedPoint/dotfiles

Please notice, I’m using SSH access – for automation use keys and password-less login.


I recommend use your own server or NAS or something like that because I’m assuming that you can use SSH and install Unison. Consider buying VPS if you do not have your own server.

About ownCloud installation: installation is simple as uploading application to web hosting folder, visiting folder in browser and fill your desired login info and optional MySQL database login info. Just check it for yourself.

After installation keep only these modules enabled:

  • Archive support;
  • Calendar (if you want to use it);
  • Contacts (same as calendar);
  • Share files;

It is good idea to disable Versions plugin. Unison keeps own versions (and I think Unison does it better) so it is redundant. For me it is even more useless because I use owncloud only as a web front-end to my data.

You might ask why I’m not using ownCloud native clients? Simple reason –Inotify and FSEvents.
There is problem with way how ownCloud client works – it polls and scans whole synchronised file tree which is CPU heavy and thus is eating my in MacBook Air battery. Using ownCloud native client can drain my Air battery in one hour. Guys from ownCloud project are currently implementing two technologies mentioned above, so there is a hope that Unison step will be unnecessary soon. But for now – it is a must.

Your data on ownCloud server are located in folder:


Go to folder and create symlink:

ln -s /home/$USERNAME/TrustedPoint/files files

Fire it up!

Pre-flight check list:

  1. ownCloud is running;
  2. you have tested Unison;
  3. you have enough of space on your server/NAS/whatever;
  4. you backed up your files;

Go for it:

unison dotfiles
unison files

Everything working? Congratulations! Run it on second Mac.

Create script to run it in batch

Put it whenever you want, I have mine in $HOME/.bin/.

#!/usr/bin/env bash

PID=$(pgrep unison)

[ -z $PID ] && unison dotfiles -batch && [ -z $PID ] && unison files -batch

Create boot plist files

Now to automate Unison via Launchd

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">







And save it to /Users/USERNAME/Library/LaunchAgents/unison_sync.plist.

Load it with plutil:

plutil -lint ~/Library/LaunchAgents/unison_sync.plist

You can try to reboot to check if everything is working as expected.


So you are in the end and this setup is working for you? I’m glad to hear it. I’m using it over 3 months I’m pretty happy with it.

To answer few questions:

  • Yes, you can achieve same thing with DropBox – I’m not using public “cloud” services;
  • Yes, you do not need Unison if you do not care about your battery. It’s up to you;
  • Yes, I enjoy DIY;

In my previous post was covered my hardware setup. It’s time to install some basic software like OS X.

Once I was pretty sure it is possible to install OS X on my hardware I visited Tony Mac X86 site and looked for some how-to.

I used this how-to and I was following pretty much everything mentioned on site.

But not everything was that straight! OS X won’t boot into install screen, after some time screen just went blank and there was no option left only to cold cycle computer. To fix this issue i had to go to UEFI and change primary screen adapter from discrete Geforce to integrated Intel graphic adapter. After this computer booted into install and i followed how-to.

After install my OS X won’t boot into setup finish (part when you add user and so on), and I had to add this option to bootloader:


This parameter fixed problem with graphic card. Without this there was only spinning wheel and no setup finish.

After this step my hackintosh has been installed. Only few steps needed to go, right? Wrong. There was problem with network adapter, bootloader, wifi card and sound card – none of them works out of the box.

You need to download Unibeast for Mountain Lion (login required) and install appropriate driver (kext – kernel extension).

For my motherboard I needed to install and enable these drivers/settings:
* UserDSDT or DSDT-Free installation
* Audio – ALC892
* TRIM Enabler with 10.8.1+ TRIM Patch
* FakeSMC Plugins
* Realtek – Lnx2Mac’s RealtekRTL81xx v0.0.90
* Patched AppleIntelCPUPowerManagement
* Boot Options – GraphicsEnabler=No and 1080p display
* System definitions for Mac Pro 5,1

Next part will cover usual problems and how to fix them. Happy hacking.

My Macbook Air mid 2011 was one of the best buys in my life. I love this piece of hardware. I have been using GNU/Linux on desktop for more than 10 years. But changes in recent years like KDE 4, Gnome 3, systemd made me think about switching.

On the other side I have been using Mac in parallel for two years in 2003. I had iBook G3 and it was also beautiful piece of hardware and great system. Many of my knowledge was born working in internet cafe on this device (funny is that I have been doing best job with no money, with only 12.1 inch screen – but this should be subject of other post).

So, this experience made me thing that it might be time to switch on desktop. To describe reasons briefly – simplified workflow (Mac Linux sync), consistent GUI and apps, no more tuning keyboard shortcuts to work same way on both platforms.

Cons was only that Mac Pro is expensive as hell and I have a pretty new desktop home. I do not like to spend that much of money (e.g. 120 000 CZK) for just a computer. Time to build Hack Pro!

If this decision came few months ago when I was building my computer i would go way of buying components based on this guide.

But I already had my hardware so let’s try it. These are my hardware specs (links to shop I bought hardware):

I’m very lucky guy – this setup was created for Linux (to work like a charm), but when I made decision about switching to hackintosh all seemed great. Building a hackintosh is always (at least according to how-to’s) about supported motherboard and graphic adapter. After quick googling hardware hardware has been looking good.

Next part will cover basic setup of my hackintosh – creating of install media, and USB installation.