Showing posts with label Mac. Show all posts
Showing posts with label Mac. Show all posts

Friday, 12 June 2015

Tutorial : Setting up Active Directory on a Mac OSX

Recently I has to write some Java code to integrate with ActiveDirectory.

My first problem was setting up an environment on my machine (a MBP) where I could test my code.

Turns out this is not too tricky if you follow the right steps.

1) Install VirtualBox (Here's a blog I wrote on this subject)

2) Download and install Windows Server 2012 (This link for 180 day free eval period) into VirtualBox.

3) Before you start Windows Server 2012 run this command on your Mac (This took me a while to figure out):

VBoxManage setextradata 2012Server VBoxInternal/CPUM/CMPXCHG16B 1

4) Once Windows 2012 is installed you need to setup ActiveDirectory.  Carefully follow the directions in this excellent tutorial.

And there you have it Active Directory running on your Mac.

In the next article I'll post the Java code you need to connect to Active Directory.

Find the largest files on you Mac (Clean up you Mac)

There are lots of complicated applications for this you can download, but really the easiest and cleanest way is with these 2 commands that can be run from a Terminal window:

This one finds all files above 100MB and prints them out with the largest files at the end (so you can deal with them first):


find / -size +200000 -ls 2>/dev/null | awk '{for (i=1; i<=NF-4; i++) $i = $(i+4); NF-=4; print}' | sort -n

Feel free to change the threshold to include more or fewer files just change the +200000 in the script.

The second command just prints the largest folders with the largest at the end:

du -k / 2>/dev/null | sort -n

One interesting thing I found was how much space was wasted by Garage Band an application that I will never use.

Tuesday, 12 May 2015

Windows Development Environment on a Mac (for free)

There's nothing particularly novel in this post but since I've just spent a half a day creating a C# development environment on my Mac I thought it would be useful to outline the steps.

Here are the steps you will need to take:

  1. Download and install VirtualBox. This is a free virtualisation product backed by Oracle. It will allow you to run a virtualised client OS as a window inside OSX. It seems to be just as good as Parallels but is completely free. 
  2. Download Windows (I chose 8.1 which is the latest full released version).  You can get this from the Microsoft Technet Evaluation Centre.  It comes with a 90 day trial license which will of course have to converted into a full licence after that period has expired.
  3. Then create a new OS inside VirtualBox for Windows. My tips here are:
      • To give the OS at least 50GB disk if you have the space.  Full installations of Windows, VisualStudio and Office take a lot of disk space (around 25GB) and you want to have a decent amount left.
      • By default VirtualBox only allocates 1 CPU to the OS.  You want to increase that, also increase the amount of memory that you give the OS if you want decent performance experience.
      • This is pretty obvious but make sure you choose the correct setting for the OS you are installing. i.e. Windows 8.1 not Windows 8 if that's your OS.
  4.  It will take about 15 minutes for Windows to install and then you will find that the screen resolution isn't quite right.  You need to install Guest device - this video describes it well.
  5. Now that you are in Windows, make it full screen and you should almost forget you are on a Mac.  Download VisualStudio. The express edition is free. It takes an age to install so make yourself a cup of tea while you're waiting...
  6. Depending on what you're developing you might also want to install MS Office.  As with Windows you can download an evaluation version from the Microsoft Technet Evaluation Centre.
  7. If you're code is in GitHub and you prefer to use a Bash command line I would definitely recommend you download Git Bash.
So there you have it a fully installed Windows environment on your Mac for free - well at least free for 90 days by which time you will probably be desperate to come back to Mac OSX again anyway :-)