Installation Guide for Linux Mint 17 / Ubuntu 14 04 on Mac mini late 2012

Installing Ubuntu 14.04 based distribution on a Mac (or any EFI based computer) has become very straightforward. If you read my previous guide on getting Ubuntu installed on Mac mini guide and thought it was long and too many things to configure, relax because you only have to run few commands with the latest Ubuntu 14.04 / Linux mint 17 distributions.

Firstly, remember that you can either split your Mac partitions using DiskUtil and have a separate partitions for your Linux or you can wipe the whole disk and have just Linux on your Mac. If you choose to go with the first, then make a partition on your Mac, of at least 10GB for Linux. And remember how much disk space you allocated for this partition as in the Ubuntu/Mint setup, you will have to point to this specific partition.

Make a bootable USB of Ubuntu 14.04 or Mint 17 (Qiana), you can easily do this by following these instructions (on your Mac).

1. Download the ISO from either Ubuntu or Linux Mint website (make sure you get the 64bit version).

2. Make sure the ISO file copied into your home directory of your Mac with the name linux.iso

3. Then run “hdiutil convert -format UDRW -o ~/linux.img ~/linux.iso” without quotes. This will take a minute or two.

4. If the output file is called “linux.img.dmg” then rename it to “linux.img”

5. Plug your USB of at least 2GB, some old USBs won’t boot so if this guide doesn’t work for your try it with a different USB.

6. Run “diskutil list” without quotes and check the output, should look like the following example. You should be able to distinguish your USB device from your hard drive because of the size, type name (it says usb_disk).


7. Now we gotta unmount the USB disk using this command before writing the image file we created in Step 3. Run “diskutil unmountDisk /dev/diskN“, where is the USB device number from the above list. As per the above example it would be 2 so command would be “diskutil unmountDisk /dev/disk2″, make sure you get yours right!

8. Making the bootable USB is easy, run “sudo dd if=~/linux.img of=/dev/rdiskN bs=1m”, again is the USB device number as per Step 6.

This step will take a while, have a coffee and come back.

9. Then you gotta eject the USB, don’t just pull it out. run “diskutil eject /dev/diskN“, again N is the USB device number you used in the above steps. Wait 5secs and then pull the USB out.

10. Reboot your Mac. Keep press “Option / alt” button when you hear the boot sound.

11. You should end up with a password screen where you need to enter your Admin password.

12. You will end up in the bootloader screen of the Mac, now plug in your bootable USB. And press Enter.

13. Continue as per normal Ubuntu / Linux mint installation except the partitions section where you should have a partition for EFI boot partition. So if you choose to have both Mac and Linux you can just split the partition you created in the first steps of this guide to two, for an example one “swap” (of at least 1 to 8GB, or whatever suits you) partition and one “/” (root) partition. And leave the boot loader installation device as as it is (bottom dropdown in partition management section).

If you choose to wipe the whole Mac, I recommend you should chose “Erase disk and install Linux Mint” / “Ubuntu” in the partition management section and leave LVM un-ticked.

14. After finishing the installation process it will ask to reboot, but DONT! get a terminal and run the following commands to make sure that GRUB is the preferred bootloader on your Mac (this overrides your Macs original bootloader sequence but your can revert it back when you want to so don’t panic).

You should also make sure the USB is still plugged into your Mac.

run “sudo apt-get install efibootmgr


sudo efibootmgr“, this will list something like the below example output

Mint is at address “Boot0000”

Ubuntu is at address “Boot0010”

Mac OS is at address “Boot0080”

above are the EFI identifiers of my mac, yours will look similar what you need to do now is alter the boot sequence.

I ran the following command, which changed my Mac boot sequence to boot Mint first then Ubuntu (which is just a phantom EFI identifier I assume), lastly the Mac’s original.

sudo efibootmgr -o 0, 10, 80

then just to confirm that above command altered the sequence run “sudo efibootmgr” again and confirm the new order.

15. Reboot using the menu in Mint/Ubuntu. Unplug the USB.

16. You should come back to Mint/Ubuntu, then you gotta fix your wireless networking if required. Make sure the USB is pugged back in then press the “Super” (Command key or Windows key) key and type “Driver manager“, press enter. You should end up in a screen like below.

Choose the Airport Extreme driver and apply.





Low colour depth in the second monitor

If you have a dual monitor setup, they you will notice that sometimes one of the monitors display less colours than the other one. I read somewhere that this issue happens in EFI based machines with Intel HD xxxx video cards, but I am not exactly sure the reason behind it.

The permanent fix for this would be to alter a configuration register for the Intel HD video card. The way I prefer for this is through the /etc/profile file.

sudo gedit /etc/profile

Add the following line

intel_reg_write 0x70008 0xC4002000

Save the file and exit. In the next boot colours will be normal on both monitors.



Enabling XDebug in AMPPS 2.2

Once you have installed AMPPS 2.2 on MacOSx and navigate to PHP section in the AMPPS UI.

Click on “Php Extension” button and you will see a list of extensions but XDebug, In order to get Xdebug to appear in that list you will have to goto /Applications/AMPPS/php-5.<version using>/lib/extensions/

and copy the file in /Applications/AMPPS/php-5.<version using>/lib/extensions/ directory to /Applications/AMPPS/php-5.<version using>/lib/extensions/ext directory.

Then the xdebug extension will show up in the extensions list.

in brief

cd /Applications/AMPPS/php-5.<version using>/lib/extensions/
cp ext/

Why I chose Linux over MacOSX after using a Mac for a year

First month with a Mac

I had never used MacOSX till January this year when I got a new job and didn’t get an opportunity to let the company know my preferred setup for work. So I ended up with a MacMini late 2012 with an i7 CPU and lots of RAM. So It was very clear to me at the time that I would be stuck with it for a long time. Since I never used MacOSX I wasn’t aware of how the mouse or keyboard works and it took me almost 2-3weeks to get familar with most of the short cuts and basic functionality, so I thought of replacing the workstation I had at home with a Mac too, so that I can spend time using MacOSX and somehow minimise all sorts of embarassing situations I faced at work specially with the basic use of keyboard, mouse and software installations :D

Somehow after buying a Mac for home use, I was very happy with it, it just worked, not like Linux where I had to mess around with for a fresh installation for days until I get it to work the way I want it to, but
on the other hand, Macs just had very few things to configure and I had to get used to the way it let me do things but I was happy because it worked. Since I am not that conservative I loved the change and the UI and the entire
user expeirence on Macs. I just had to install iTerm2 and Homebrew to get some software up and running but that wasn’t of any concern.

I thought I should also write few words about Mac hardware too, their aluminium uni-body design and craftsmanship is so excellent that I always thought it is piece of well engineered hardware.

In brief, was very impressed with both software and hardware.

After few months…

After the first few months of using MacMini with MacOSX I came across lots of annoying issues, and some of which are listed below.

Least concern first

In Linux or at least on the distributions that I have used supported moving cursor between words by pressing <Ctrl> + <Left | Right Arrow>, so when ever I wanted to make a code/document change that I have been working on, all I had to do was press the Control + arrow keys on the direction of the word I want modified and cursor keeps jumping based on the way I have configured Keyboard (or press the arrow key n number of times so it skips n number of words in the direction you want) settings in Linux but in OSX that moves the cursor to the beginning or the end of a word which was very frustrating when I was getting used to Macs. Also HOME and END keys on OSX worked in a way that was so strange compared to all other operating systems. END key was pretty much useless at least I couldn’t / didn’t know how to use it properly…

Dual monitors (this issue has been solved in the Latest Mavericks release)

The very first complaint would be full-screen mode of applications making the second monitor useless. Some mostware had built in full-screen modes so they let the second monitor free for the user, but system default full-screen
made the second display useless. I heard that the new version of OSX will come out with better screen management for multi-monitor setup but so far it has been painful.

Making a window always on top and moving windows across monitors 

You cannot do this as of OSX 10.8.4, without hacking their window management system a lot, I found some hacky ways to get that done but didn’t want to install all sorts of legacy(xquarts) software on my mac to get something so simple to work.
Again some software like mplayer had its own ‘always on top’ settings when playing movies, etc. but it wasn’t a generic setting for all applications which is provided by the OS. This made me sad, as I tend to use terminal or
some other software in a small window and leave it on the corner of my editor so I can quickly compile software, etc (just one example).

Moving a maximised window from one monitor to the other is so difficult you have to leave it precisely on the correct edge of the second monitor, the window manager of OSX doesn’t take care of it for you. In Gnome, KDE, etc all I did
was just grabbed the title bar and moved the cursor to the second monitor and release mouse so it sticks on the second monitor stretched edge to edge with its default state (maximised in this example), I didn’t have to
resize or prcisely move the window. This was a freaking pain.

Network shares

At this point I started using my home Mac to work on externally hosted projects, which I connected to through OpenVPN and mount source code directory on my workstation so that I can use my editor (Sublime and MacVim) easily.
In order to get this done, I had to either mount the directory through Finder (using network shares), or use terminal to mount it on the directory I want. Since I had few projects running I had few servers connected at any given time,
and all of them had the source directories in one specific path (assume it was /var/www/htdocs for now), so when I wanted to mount that path on my workstation the first server was mounted on /Volumes/htdocs and the second was /Volumes/htdocs-2.
This wasn’t very convinient to me as I wasn’t sure which dir is which server when I had more than 3 mounted at the sametime. If I use terminal however I could mount with custom directory names I wanted, but I still could see those
production servers in the Places section of Finder and if I ever click on one of it accidently then the clicked server share gets mounted again. So OSX wasn’t aware that a perticular network share is already mounted on whatever the dir I wanted.
This was a bit annoying to me.

Getting a cross-compiler to work

I play with all sorts of embedded computers, so I was hoping to get a cross-compiler installed on my Mac so that I could write apps and compile them on my workstation  rather than trying to install a toolchain on the embedded system and wait ages to compile something with its low-powered processor.

This is again a painful experiance and I read somewhere that MacPorts (homebrew alternative) supports installation of gcc for ARM, but homebrew never did, and HFS filesystem was case-sensitive and I had to create another partition to get GCC to compile but didn’t work perfectly either, so I had to run a VM to compile all multilib c/c++ apps.

HFS Filesystem

I don’t even know where to begin, I can either have HFS, FAT(exFat included) and NTFS on Macs, which stopped me from using my 2TB backup hard disk using with other computers at home. If I use FAT on it, it wouldn’t support symlinks or case-sensitive file structures. So I had to write my own backup script which makes an archive before backing up and then copy the files to the HD.

I will explain one issue I had with HFS, once I wanted to build a toolchain and install GCC like I mentioned above, since I never had any issues with other software I thought of reformatting my Mac and make the primary partition case-sensitive. So I did. I was happily working with the case-sensitive filesystem until I try to install Adobe Photoshop on it. Then it complained it can’t install Photoshop on case-sensitive filesystem so I was pretty much screwed xD at the end I reformatted back to case-insensitive and install photoshop then installed the crosscompiler toolchain on a separate case-sensitive partition. But this is just one issue which wasted a whole weekend.

Last not least, memory management in OSX :)

You probably already know where I am trying to get to, and I found a nice explanation of why it sucks on Mac

OS X has a feature called inactive memory. This is memory that was recently used by an app you closed and can be quickly made to active memory if you resume to use that app. A nice concept, that fails miserably. OS X’s documentation says, that this memory may be freed at any moment. However in practice, it just keeps on accumulating until you run out of free memory. In this case a sane option for the OS would be freeing the inactive memory. Instead the OS X decides to swap the inactive memory on the disk. So when running out of free memory and having a 1,5 gigabytes of inactive memory left, your OS starts paging the unused inactive memory to disk instead of freeing it for applications to use. Not only this causes your computer to slow down, it also is counter-intuitive in the terms of the original idea of inactive memory: when it’s on disk, it definitely is not made active quickly.
I managed to find out that this memory can be freed with combination of XCode’s purge-command and repairing disk permissions. First usually freed around 200MB of memory while latter freed almost every bit of inactive memory. Eventually this became a daily routine. When arriving to work the first thing was to hit repair disk permissions button and do something else than actually use the computer for the next five to ten minutes. Sigh.

Why Linux based distro (I use debian derivatives)?

In few words, it lets you free from all the restrictions that OSX puts on you.

I run Mint on my workstation (MacMini) and ElementaryOS on my Acer V5 celeron with Cinnamon and Pantheon as window managers. I never had any of the problems I mentioned above on a Linux box, but I had hardware issues like getting MacMini wireless driver (Broadcom BCM4331) to work, but I somehow manage to fix it and write an article about it. So in brief if you can initially spend few weeks configuring and figuring out the best configuration for you in a Linux based distro then you will be safe for a foreseeable future. Now that’s what I understood after using my MacMini with OSX for more than 10 months, now I prefer to invest some time initially on the configuration I need over trying myself to adopt OSX so hard (which is clearly not meant for me, at least for now).

Apt-get software management and Linux memory management so well designed that makes most of getting software to run on a Linux system is so much fun and easy to do.

I should give some credit to developers who designed MacOSX UI, that’s the only thing I miss so far, those clean, beautiful interface and the magic mouse, which I miss everyday!

PLEASE NOTE: that this is completely my personal opinion and you may find MacOSX suit best for you, most of my colleagues love it too :D so if you have ways to fix the issues I had with OSX or any other constructive criticism please leave a comment.

How to Setup an Amazon AWS EC2 NFS Share

This article will be short and to the point, so whoever wants to mount a remote nfs share in their local machine they should be able to get it up and running in 5 mins or less. Here we go!

Step – 1 Setup AWS security groups

In your EC2 instance setup following Security group exemptions, it would be a good idea to create a separate security group called “NFS Services” or something to leave these exemptions separate from the rest of your security groups.

Port (Service) Source
Port (Service) Source
32770 – 32800  

I have set source to for those ports but I do restrict who can access those services via /etc/hosts.deny in next step. Or if you prefer set the IP address of the client machine (external ip) to source when you add those port exemptions.

Step – 2 Install the NFS server

You need a running NFS service in your remote server so that the client can access shared directories/paths, install nfs server by typing the following line in the terminal of your aws instance.

sudo apt-get update && sudo apt-get install nfs-kernel-server

Step – 3 Decide what you want to share

Whatever you wanna share should go in /etc/exports file. So edit it using nano/vi/ or whatever text editor you have in the terminal, I use nano here

sudo nano /etc/exports

and add entries of the directories you want to share

/home/purinda *(rw,async,insecure,all_squash,no_subtree_check,anonuid=1001,anongid=1001)
/opt *(rw,no_subtree_check,sync,insecure)

If you read a nice article on how these exports thingy work you will figure out that the astrix is to specify the client IP (which can be specified as a CIDR address such as or * to allow any client).

I have a different configuration set for /home/purinda as I use a Mac OSx 10.8.2 mountain lion client which uses nfsv2 client to connect and it require some security tweaks like I have mentioned. Or read my other article on this subject.

Step – 4 Reload the NFS service 


sudo service nfs-kernel-server reload

to reload the NFS service on your ec2 instance.

and you may or may not require

exports -av

Step – 5 Connect!

In your local/desktop open up a terminal and create a directory which should be used for mounting the remote directory, for example if you want the remote /home/purinda mounted in your /Volumes/purinda in MacOS x


mkdir /Volumes/purinda
mount -t nfs -o nfsvers=2 <elastic-ip-of-ec2>:/home/purinda /Volumes/purinda/

on a linux desktop/client you may be able to just do

mount -t nfs <elastic-ip-of-ec2>:/home/purinda /Volumes/purinda/


NFS Shares between Ubuntu 12.04 and Mac OSX 10.8

Mounting NFS volumes between Ubuntu and Mac OS X 10.8 was a problem for weeks, I started using SMB shares as I couldn’t get both systems live in harmony! But today fiddling with zillion different configurations in both sides I got Mac OS X to accept my NFS exports from Ubuntu 12.04. This is how I got it working….

First you need to export directories from Ubuntu end, so you may need nfs-kernel-server package installed in the ubuntu system.

sudo apt-get install nfs-kernel-server

Then edit /etc/exports file as root. Normally, you would

sudo nano /etc/exports

Then add whatever directory you wanna share to the Mac OS X (or any NFS compatible computer). Here, I have shared my Projects directory under /home/purinda (my Home directory).

/home/purinda/Projects *(rw,async,insecure,all_squash,no_subtree_check,anonuid=1001,anongid=1001)

To exit nano after saving your changes, use Control+O to save the file and Control+X to exit.

Lets go through each settings to understand what it does,

“/home/purinda/Projects” is what you are sharing with others.

* represents that you’re sharing it with any client machine, usually for security reasons you may want to put something line “” without quotes to share it only with a single client, or “” to share it to all clients in your Class C network. I am * (any) as the machine I am working on is a virtual machine and only exposed to the host computer and other VMs in the virtual network.

manual page for ‘exports’ (`man exports`) gives a good explanation.

Once you have edited the exports file correctly. You can restart nfsd (nfs server daemon) using

sudo service nfs-kernel-server reload

You can also use following command to export new shared directories, whenever you make changes to your exports file,

sudo exportfs -ra

To mount it, on the Mac get a terminal and type (change host and directory path to suit your requirement)

mount -t nfs -o nfsvers=2 /Volumes/Projects/

‘nfsvers=2’ option is important for mac osx and ubuntu to be compatible with each other.

UPDATE: 19/09/2014 

I tried to follow my own instructions and failed, not because they were wrong but the way Ubuntu upstart initiates services.

When I tried to mount the exported directory on the client Mac I got “Cannot retrieve info from host: RPC: Program not registered“.

The way to fix the issue is, on the NFS server restart rpcbind service before starting NFS-kernel-server.


sudo service rpcbind restart


sudo service nfs-kernel-server restart

Try remounting