Just Code it!

This post is actually part of a more specific article I wrote that explains how to install OSX on a Virtual Machine in VirtualBox. You can find this other article here:
Install OS X on VirtualBox (on OS X)

This guide will show how to create an installer of your OSX system. Once done, you will be able to use it if you want for example wipe your current system and start fresh with a brand new OSX Installation, or proceed and use it to install it on a VM as I mentioned before.

I will show how to download the latest version of OSX (El Capitan at the time of this article) or an older one you previously owned (Yosemite for example).

Download the latest OS X Version (El Capitan)

To download it, you can pass through a web browser going there:

and clicking then “View in Mac App Store”:

To select then “Launch Application” and land in the App page on the App Store:

Or open directly the App Store on your mac:

and search for “El Capitan”:

Despite how you reach this stage, you will have then click on the App or just select “download” and…

… wait and wait…

Once the download is complete you can see the installer in the Application folder:

Prepare the USB

In order to create the installer you need to insert a USB stick (I will use a 16GB drive).

It is not strictly required to wipe the whole content of the USB drive but it is something I prefer to do anyway… and it takes really few seconds to do so (feel free to skip this section if you really want to).

Open “Disk Utility“.

You can find this app in the Applications/Utilities folder:

Or use Spotlight search (that you can open with CMD⌘ + SPACE) and start typing “Disk Utility”:

Once started, locate your drive on the left side (it should be easy to identify in the “External” section).

Select it and click the “Erase”:

At this point give the drive a label (it will not really matter if you are going to create an installer because it will be automatically changed later on), select the Format “OS X Extended (Journaled)” and “GUID Partition Map” for the Scheme:

Click “Erase” and wait for the operation to complete. Then click “Done”:

Time to create the installer.

Create a Bootable USB Installer

We need now to put the installer on this USB drive and make it bootable.

Open the Terminal window.

You can find it again in the Applications/Utilities folder or as usual with Spotlight (CMD⌘ + SPACE) search for “Terminal”:

NOTE: Assuming you named the USB drive “OSX”, the volume will be in “/Volume/OSX“. If you gave it a different name you will need to change the following command in order to point it to the correct location of your volume.

Type the following command:

Type your password (you will require root privileges), type “Y” when required to confirm your action and wait for the configuration to complete… it could take some time, so be patient (I’m talking even over 30 mins!):

Note that this procedure will erase the content of the USB and change its label to “Install OS X El Capitan“.


Install OSX!

You can now restart your computer. Make sure you keep the key ALT⌥ pressed while the mac is booting up!

Doing so you should see a startup selection screen similar to this one:

where you can select your newly created installer USB and follow the installation procedure.

Enjoy :)

Download a previous OS X Version (Yosemite)

If you want to download a previous version of OS X you will soon notice that it will not be available on the App Store for download.

There is still a way though if you already purchased it in the past.

To access it open the App Store, and click the “Purchased” section:

Scan through your list and locate Yosemite:

Click the “Download” button and confirm your intention to Apple clicking “Continue” on the popup:

Wait then for the download to complete:

At the end of the download:

you could receive another message from Apple that just says that this is an old version of the OS. Just ignore it:

The installer will be placed in the “Applications” folder:

You can now proceed with the same procedure described above for El Capitan if you want to create a USB Installer.

That’s all!

Once again, please share and comment if you found this article interesting or useful.



As for other posts (see Boost Libraries Installation), this post is actually a sub-post I made while I was writing a larger post where I explain how to download and use MySQL connector C++ libraries (MySQL C++ with mysql-connector).

That post soon became pretty big due to the amount of stuff you need to configure in order to achieve the goal, therefore I decided to split it in smaller posts that on one side are useful on their own and on the other helps in keeping the main post they came from slightly smaller and easier to follow. Because of this I will keep these posts quite short.

If you are interested in this post as well, you can find it there:

For this example I will use MySQL Connector for C++ as a sample to show the usage of CMake to generate Visual Studio solutions.

Let’s start!


CMake (3.0.2) – Download and Install

In order to build the source code for the connector libraries we need to download CMake
Go to the CMake website:
and download it:
Select the Installer in this case:
Execute the installer. I selected the option to add it to the system PATH for an easy access:
Just go Next until the end and Install it.
CMake (3.0.2) – Test
To test that everything is ok with cmake, open a command console and go into the folder where we extracted the connector code and execute:



We should see this output:

We can generate the Visual studio project in two ways:

  • Using the GUI
  • Using the command line



CMake (3.0.2) – Usage from Command Line to generate the Visual Studio Solution
At this stage, if you are following the MySQL connector tutorial () you want probably to go back to follow the rest of the tutorial, where you will install first all the required libraries and systems that you need in order to successfully execute the next command.
If you did instead all the required step and everything is correctly configured or you want just to see an example of the usage of CMake for this purpose, then keep reading.

Now we can go back into our connector folder and try once again to recreate our Visual Studio Solution:
C:\libs\mysql-connector-c++-1.1.4>cmake -G “Visual Studio 10”



Now, if everything went as planned, you should be able to see a solution file (and other files as well) into your connector’s folder:

You can then open the solution and continue from there.
CMake (3.0.2) – Usage from GUI to generate the Visual Studio Solution
An alternative way to generate the Solution file is to use the CMake GUI.
Launch the cmake-gui from the start menu:
In the window that opens select “Browse Source…” button and locate the root of your project.
I will select the one where the code for MySQL Connector has been extracted:
Copy the same path for the binaries, then click on “Generate” (or Configure) and select the IDE you are interested in.
I will select Visual Studio 2010 for this example.
Click “Finish” when ready:
Everything should complete successfully (pay particular attention at the bottom window without being too much scared by the red entries in the main window):
If you try to click once again (or why not… a couple of times as well :P) on the “Generate” button, all the red should disappear from the main window:
Anyway, despite the colouring, you should still be able to see your new solution file generated and ready to be opened in Visual Studio.
Now, if were following the MySQL connector tutorial (MySQL C++ with mysql-connector) you can go back and follow the remaining part of that tutorial.


Boost Libraries Installation

January 25th, 2015 | Posted by riccardotramma in Boost | C++ | Download - (0 Comments)

This post is really a subpost I made while I was writing a larger post where I explain how to download and use MySQL connector C++ libraries (MySQL C++ with mysql-connector).

That post soon became pretty big due to the amount of stuff you need to configure in order to achieve the goal, therefore I decided to split it in smaller posts that one one side are useful on their own and on the other helps in keeping the main post they came from slightly smaller and easier to follow. Because of this I will keep these posts quite short.

If you are interested in this post as well, you can fint it there:

Let’s enter in the core of the topic now!


Boost Libraries (1.56.0) – Download
Let’s download them here:
Just click on the Download link:
Click then on the zip file:
Once downloaded extract it, for example in the same lib folder, so you should now have:
Boost Libraries (1.56.0) – Install
Enter into the boost_1_56_0 folder and execute the file “bootstrap.bat“:
The output should be: 
The next step, is to execute “.\b2”. We could use some parameter here, such as:
b2 install –prefix=PREFIX 

where PREFIX is a directory where you want Boost.Build to be installed.
Optionally, add PREFIX/bin to your PATH environment variable. 

We will be ok with the default setting, therefore we will just execute:

C:\libs\boost_1_56_0>b2 install
It will start to compile the code… it will take a bit and a loooong output.
The initial part will be something along this line:


Once this is done you should see a new folder on your drive: “C:\Boost\
This is how the situation should look like at this point:
That’s it for this part.
As mentioned this is a subpart I splitted from a larger topic.
If you want to continue the reading of the original topic that originates this continue here: MySQL C++ with mysql-connector
Thanks and share and comment if you find this useful or interesting.

Comment or Leave a Message

Please Comment or Leave a Message if this is what you are looking for or if you have any question/comment/suggestion/request.

To me, one of the most surprising thing about NAnt is that it doesn’t support colours out of the box.
NAnt is an amazing tool that allows to build software through a set of really powerful tasks. You can download it from here: http://nant.sourceforge.net/.
I use it quite a lot in different projects and one thing I always missed is the support for colorised console output.
I think that echoing something using different colours helps a lot, even if only to provide a quick spottable info that can help the user (the guy in front of the pc that is waiting for the build to complete) to understand the build stage (especially if it is a long build with several stages).
As soon as I had some time to spend on it I decided to write this feature myself and here I am, sharing this with whoever needs it for its own personal/business process.
I provide the DLL that you can use freely. If you find it useful the only thing I ask is if you can leave a comment and if you have a web page, add a link to this page to help other users.

What it adds
In brief this is the list of functionalities that you will have:

  • setcolour – to select the current colour
  • pushcolour/popcolour/resetcolour – to manage a stack of colours, so that you can change a colour and go back to the previous when you are done.
  • echocolour – an upgrade to the base echo task that colours the message
  • execcolour – an upgrade to the base exec task that colours the output in case of error (behaviour and error colour configurable)
  • colourfail – an upgrade to any other generic NAnt task, operation or set of operations that colours the output in case of failure (error colour configurable)

The list of tasks that allow to use those functionalities are (in more detail): (Note that you can have this list using the <helpcolour /> task)


  • <setcolour [colour=”fc”] [bg=”bc”] [preserve=”tf”] /> – Set the current colour.
  • <pushcolour [colour=”fc”] [bg=”bc”] [preserve=”tf”] /> – Push the color in the stack of colours and set it as current colour.
  • <popcolour /> – Remove the color on the top of the stack and set the previous one as current colour.
  • <resetcolour /> – Reset the colours stack and set the original color as current colour.
  • <seterrorcolour [colour=”fc”] [bg=”bc”] /> – Set the colour to use when an error occurs during the execution of execcolour task.
  • <reseterrorcolour /> – Reset the default error colour (red on black background).
  • <echocolour message=”Message Here” [colour=”fc”] [bg=”bc”] [preserve=”tf”] /> – Echoes the message in the chosen colour.”
  • <execcolour [highlighterror=”tf”] …more… /> – Extends the default exec task adding colours capabilities (use the usual “exec” task parameter here). It shows the error using the error colour and, if used with failonerror=”false” and highlighterror=”true” shows the exec exit code using the error colour if it is different from 0 (and logs it as a warning).
  • <colourfail [colour=”fc”] [bg=”bc”]> …any othe task there… </colourfail> – Extends the failure colour to everything executed inside the colourfail initial and closing tags. E.g. <colourfail> <fail message=”simulated failure” /> </colourfail>
  • <initcolours [silent=”tf”] /> – Initialise the default colour using the current console colour. The default error colour is set to the current error color. Using silent=”true” the DLL version number will not be displayed when the first colour task will be used. NOTE: This task is optional and you can use all other tasks without worrying to use this at any time.
  • <helpcolour /> – Shows this help…

fc : specify the foreground colour to use.
bc : specify the background colour to use.
[…] : specify an optional parameter.
tf : use “true” or “false” there.
…more… : indicates other parameters.
preserve : Preserve the current fc and/or bc when fc and/or bc is not specified. This is false if unspecified.
highlighterror: This is false if unspecified.

How to set-up
To use this dll, put it somewhere where your NAnt executable can reach it. If you prefer you can directly add it in the same folder of NAnt.exe.
Somewhere at the start of your NAnt script add this line (assuming that it sits in the same folder):

From now on you will be able to access its functionalities in your script.

Feature – Colour Help Command (helpcolour)
Use this task as a reminder for the supported tasks:

Feature – Direct Colour Change (setcolour)
You can use console color using this syntax:

The output is:

Feature – Coloured Message (Echo Extension: echocolour)
A more direct way to output colour messages is using directly the echocolour task:

With this result:

Feature – Use Colour Stack (pushcolour, popcolour, resetcolour)
There is a way to use the colours pushing and popping them in and from a stack. This can be useful when invoking sub targets that have to set the colour for themselves but you want them to restore the colour to the previous one when finished.
This is a simple Example:

With this result:

To reset the stack at any point you can use the resetcolour task. Example:


This is a more complex example of stack usage:

With this result:

Feature – Exec with coloured failures (Exec Extension: execcolour)
In order to quickly use the exec task but with coloured failures, you can use the execcolours task. Those are some examples:
A Simple exec that fails (Building a solution with an error in it):

This is the output:

An option is to suppress the failure (as in exec task), but force to highlight the error anyway. This is optional:


Feature – Change Error Colour (seterrorcolour, reseterrorcolour)
The error colour can be changed at any time using seterrorcolour and reseterrorcolour (to bring it back to the default “red” colour):

And this an excerpt of the output:

Feature – Color the failure of any other task (Generic Extension: colourfail)
If you want to highlight the build failure of any other NAnt task or your other custom task, you can still do so using colourfail!
Here is a really simple example of usage:

And the result will be:

Another different example is:

Resulting in:

Of course you can wrap the whole script in this task, having the coloured error feature always active.
An example that shows this is action is the following:

With the expected result:

Feature – Init the default colour and error colour (initcolours)
This task is optional. Everything works even if this is never used.
You must use this as first task if you want to remove the display of the version number that is automatically shown the first time a colour task is used.
When used it will change the default colour and error colour using the current one. This allows to change the result of the task resetcolour and reseterrorcolour.
This is an example:


Note that the colour of the console is still recovered despite the default colours have been changed.

More about Colours
The colours must be colours recognised by the console. The system is quite robust but it is safer if you specify the colour using the correct case sensitive string. This because the core tries to match the string to an internal enumeration and this is why it needs to match.
In any case, if the colour is not recognised, or simply wrong, an error will fire allowing to fix the mistake.

Will generate:

I believe this DLL can offer a satisfying set of features to use colours in NAnt with a reasonable degree of flexibility.
Download and use it freely. If you like it, please add a comment and a link to this page to help others benefit of it.
If you have any suggestion, comments or if you want to make a request for something to add in future release, please leave a comment :).