DevOps Engineering part 1. (Mac) – Install the DevOps development tools on Macintosh

Enable the right-click

To be able the right-click on the mouse

  1. Open settings.
  2. Enable Secondary click for the mouse and the trackpad.

Lock the screen

On High Sierra

  1. Press the Cmd-Ctrl-q key combination to lock the screen.

On earlier MacOS versions

To be able to lock the screen from the menu bar:

  1. In Finder search for Keychain Access and start it,
  2. In the Keychain Access menu select Preferences,
  3. Check the Show keychain status in menu bar checkbox,
    This will place a lock icon in the menu bar.

To lock your screen

  1. Click the lock icon in the menu bar
  2. Select Lock Screen

Show the full path in Finder

  1. Open Finder
  2. In the View menu select Show Path Bar
    Finder will show the full path of the current folder at the bottom of the window. 

To jump to a folder shown in the path bar just double click it.

Show hidden files and folders

  1. Open the terminal and execute the following line
    defaults write AppleShowAllFiles YES
  2. For the change to take effect relaunch Finder.
    • Press the ‘Option/Alt’ key, right click on the Finder icon in the dock and click Relaunch

Show the battery charge percentage

  1. Click the battery icon in the toolbar
  2. Select Show Percentage

Apple Id without credit card

If you don’t have an Apple Id, create one. To obtain one without a credit card, you need to create the account in an older version of iTunes. In version 12.7 Apple removed the access to the App Store.

  1. Downgrade iTunes on your Mac to version 12.6. Follow the instructions at
  2. Start iTunes 12.6 on your Macintosh,
  3. Click the drop-down menu in the upper left corner,
  4. If Apps is visible, select it, otherwise click Edit Menu
    • Select Apps, and click Done to display it in the drop down.
  5. Search for a free app in the App Store and start to download it,
  6. Create a new Apple Id and select None for credit card type.

Show the user home directory

  1. Open Finder
  2. In the Finder menu select Preferences
  3. Select the Sidebar tab
  4. In the Favorites section select the checkbox next to your user name

Create a directory for optional applications

Create the opt folder in the root of the hard disk.

Memory usage monitor

  1. Download  Dr. Cleaner Elite from the App Store to be able to monitor memory, CPU and network usage from the Menu Bar.

UTC Clock in the menu bar

BitBar is a plugin manager that can display plugins in the menu bar. One of them is World Clock that can display multiple clocks in a drop down of the menu.

Install BitBar

  1. Navigate to
  2. Click the Get BitBar button
  3. Click the downloaded ZIP file to extract the application
  4. Move the BitBar application to the Applications folder
  5. Launch BitBar form the Launcher
    • The first time BitBar launches, opens the Finder to point to the BitBar plugins folder
      • Click the New Folder button to create a folder for plugins in the Documents folder: BitBar Plugins
      • Click the Use As Plugins Directory to select the new folder as the plugins folder

Add World Clock to BitBar

  1. Navigate to
  2. Click the + Add to BitBar button

Customize World Clock

To customize World Clock edit the file in the BitBar Plugins folder

To change the displayed timezones, edit the ZONES variable inthe file:

ZONES="US/Pacific UTC Europe/London Europe/Berlin Asia/Kolkata Asia/Tokyo Australia/Sydney"

To change the display format, edit the data formats.

  1. To remove the seconds from the menu bar, delete the :%S from the format line
date -u +'%H:%M UTC'

To add the day of the week and date to the clocks in the World Clock drop down


  • %a for the day of the week
  • %Y for the four digit year
  • %b for the name of the month
  • %d for the date
  • %z for the time zone offset
echo "$(TZ=$zone date +'%H:%M - %a, %Y %b %d %z') $zone"

To refresh the dropdown formats after making changes in the config file

  1. Click the World Clock in the menu bar
  2. Select Preferences, Refresh all


Homebrew can install packages on your Macintosh that apple does not provide.

Installation instructions are at


NPM is another package manager. Install it to be able to install other applications later on this page, including the SQL Command utility

brew install node

Remote Desktop Client

Download the Microsoft Remote Desktop app from the App Store

  1. Open the App Store
  2. Search for “microsoft remote desktop”
  3. Click the Microsoft Remote Desktop icon
  4. Click the blue Get button
  5. Click the green Install App button

Text Editor


  1. Download it from
  2. Double click the downloaded ZIP file to extract the application,
  3. Drag the Atom application into Applications

Configure Atom

See Atom text editor configuration


Terminal Window


Install iTerm2, a smart terminal emulator to issue Bash commands and log into Linux servers.

  1. Download iTerm2 from
  2. Double click the downloaded ZIP file to extract the application,
  3. Move the iTerm application to Applications.

iTerm2 configuration

Enable unlimited scroll back

  1. Start iTerm2 and open the preferences window by pressing ⌘, (command-comma)
  2. On the Terminal tab click the Unlimited scrollback check box.

Set the highlight color

By default the highlighted text just a little different from the rest. When we search for something, it is hard to notice the found text.

To change the highlighted text color

  1. Start iTerm
  2. In the iTemr2 menu select Preferences…
  3. On the Profiles tab set the color of the Selection and Selected Text

Start iTerm2 from Finder

To be able to open iTerm2 in any folder from Finder follow the steps below based on

  1. Start Automator,
  2. Select Service and click Choose,

  3. On the top of the screen set Service receives selected to files and folders,
  4. Set in to Finder,

  5. On the second side bar from the left double click Run AppleScript,

  6. Paste the code from the website referenced above into the editor window replacing the sample script in the editor window,
  7. In the File menu save the script,
  8. Do not run it, it does not execute in the Automator.

To use it

  1. Open Finder and navigate to the location you want to work in,
  2. Right click a folder to work in that folder or a file to work in the current folder
  3. Select Services, iTerm2 in Finder


“Solarized” color scheme

  1. Download the color scheme to the Desktop with the following Bash command:
    curl -o ~/Desktop/solarized.itermcolors
  2. Import the color scheme to iTerm2
    • Press ⌘, (command-comma) to open the Preferences window
    • Select Profiles
    • In the lower right corner of the Colors tab click the Color Presets… drop down
    • Select Import
    • On the Desktop select the downloaded solarized.itermcolors file
    • In the  Color Presets… drop down select Solarized Dark

 Meslo Powerline font

  • Import the Meslo Powerline font with the following bash command:
    git clone && cd fonts && ./
  • Select the font in iTerm2
    • Press ⌘, (command-comma) to open the Preferences window
    • Select Profiles
    • On the Font section of the Text tab click the Change Font button
    • Select the 12pt Meslo LG L Regular for Powerline

Make the prompt shorter

to remove your username@computername from the prompt

  • Edit the ~/.zshrc file
  • Add the following line

Colored prompt

To color the prompt:

  • Download the agnoster theme
sh -c "$(curl -fsSL"
  • Edit the ~/.zshrc file and set the ZSH_THEME to ZSH_THEME=”agnoster”

More configuration suggestions are at

Information on how terminals read settings at


  • Navigate to to download Git for the Macintosh. The page automatically downloads the installer for the operating system you use.
  • This app is not trusted by Apple, so to install it
    • Control-click (right-click) the downloaded file and select Open
    • Click the Open button to confirm the action

Configure Git

To configure Git see Git configuration.


For the VirtualBox installation on your operating system see: VirtualBox


For Vagrant installation see Vagrant.


Ruby is already a part of the operating system.

Chef Development Kit

Terraform by Hashicorp

 Terraform Installation

  • Download Terraform from
  • Double click the downloaded ZIP file to extract the application
  • Create a directory, terraform for the Terraform application in the /opt folder
  • Move the Terraform application into the terraform directoryin the /opt folder

Add the location to the path

Depending on the terminal window you use, it may open different configuration files. If you use iTerm2 you need to update the path in the~/.zshrc file.  Other terminal windows usually read the configuration from the  ~/.bash_profile file. To be safe you can add the following to both configuration files:

# PATH Export
export PATH


Graphviz is a Dependency Graph Visualization Software. We will use this utility to display the Terraform graphs.

To install execute the following in the terminal

brew install graphviz


The Amazon Web Services command line interface installation will set up your workstation to launch instances in AWS from Test Kitchen. If you know you will work with AWS, see DevOps Engineering part 3. – Working with AWS for the AWS CLI installation.

SQL Command

To be able to execute Microsoft SQL commands from the command line or through Terraform, install the MS SQL utility

npm install -g sql-cli

Version information

mssql --version

More information on the tool is at


We use Packer to create custom AWS AMIs that contain the fundamental configuration and applications that are common in every instance we launch.

Install Packer

  • Add the Packer installation directory to the system path

Nice to have utilities


To easily organize your windows, (make them full screen, show two applications side-by-side, etc.),  install Spectacle from

  1. Download the ZIP file,
  2. Extract it, and move the Spectacle executable to the Applications folder
  3. Set it up for auto-start, see Set up an application to auto-start on macOS

Disk Inventory X

This utility displays the graphical representation of file sizes and helps to find the biggest files.

  1. Download it from

Working with Windows servers from the Mac

If you want to work with Windows servers, you may need to run Windows applications on your workstation.

See Minimum Windows workstation setup to work with Windows servers


Set up the DevOps development environment in Beginner’s Guide to DevOps Engineering part 2.


to the Tutorials page

Warning: Attempt to present … on … while a presentation is in progress!

There is a warning message in Xcode, the Apple iOS development environment that can have many different causes.

Warning: Attempt to present … on … while a presentation is in progress!

In my case Xcode displayed the warning because a button called the same view twice.

xcode multiple calls to viewcontroller

When I deleted the action associated with the Touch Up Inside event the warning disappeared.

Xcode app development troubleshooting

This post is a collection of common error messages you may receive during application development in Xcode.

Error message

Receiver ‘NSManagedObjectContext’ for class message is a forward declaration



#import <CoreData/CoreData.h>

to the … – Prefix.pch Prefix header file in the Supporting Files folder


Save an image in the Xcode iPhone simulator

When you are testing an app in the Xcode iOS Simulator sometimes you need to select an image in the photo library. To add images to Photos in the Xcode iOS Simulator

  • Run you app in the iOS iPhone Simulator
  • In the Hardware menu select Home to hide your app
  • Open the Safari browser in the iOS Simulator
  • Navigate to a page with images
  • Press and hold the mouse on the image for a few seconds
  • A pop-up window appears
    ios simulator save image
  • Select Save Image to save the picture in the photo library of the Xcode iOS Simulator

Extend the iPhone view in Xcode

When you design an iPhone, iPad view in the Xcode Builder and place a Scroll View on the View Controller you can make the page larger than the physical size of the screen of the device. To see the whole view set the size of the View.

  • Open the Story Board in Xcode
  • Shift Control Click the view to display the list of objects under the mouse
  • Select the View Controller
    xcode select layers with shift control click controller
  • Open the Utilities view
  • Select the Attributes inspector
  • Set the Size to Freeform
    xcode set controller size freeform
  • Shift Control click the view again
  • Select the View
    xcode select layers with shift control click view
  • Select the Size inspector
  • Set the Height to a larger number
    xcode set view height

This will extend the size of the View Controller, but most likely will move the objects to occupy the whole space.

If some of the objects disappear from the visible area of the View, you can set the coordinates of the upper left corner to move them back to the visible region.

  • Open the Storyboard
  • Open the Document Outline view
  • Select the object you want to move
    xcode select object in outline view
  • Open the Utilities view
  • Select the Size inspector
  • Set the Y coordinate to a number that is within the visible area
    xcode set object position
  • Now you can click the object the move it with the mouse

Apple Objective-C programming fundamentals. Working with Data, Part 2, Create the data model

In this part of the series we will continue the development of our data store app that we set up in the first part of the series.

Create the Data Model

  • Open your sample application that you created in the first part
  • Open the Project Navigator
  • Select the Supporting Files group
  • Click the plus (+) sign in the lower left corner of the screen
  • Select New File… in the pop-up
  • Under iOS select Core Data on the left side
  • Select the Data Model icon in the middle of the window
  •  Click the Next to save the file

xcode create data model


Add an Entity to the data model

  • Open the .xdatamodeld file in the Project Navigator
  • Click the Add Entity button at the bottom of the screen
    xcode data add entity
  • In the upper right corner of the window under Entities name the entity Event
    xcode data entity name

Add an attribute to the Entity

  • Click the plus (+) sign at the bottom of the Attribute section of the window
    xcode data add attribute
  • Name the attribute creationDate, and set the type to Date in the pop-up menu
    xcode data attribute date
  • Add another attribute, name it as latitude and set the type to Double
  • Add a third attribute, name it longitude and set the type to Double
    As you are adding the new attributes the rows jump around to be displayed alphabetically, so make sure you are setting the type of the correct row.
    The attributes of the Event entity should look like this
    xcode data event attributes

Create a custom class to represent the Event entity to be able to create methods for the entity

  • Select the Event entity on the window
  • In the File menu select New -> New File…
  • In the New File dialog, select NSManagedObject subclass
    xcode data create managed object subclass
  • Click the Next button
  • Save the file in the project folder

Import the new class into the ViewController

  • Add the following to the RootViewController.m implementation file
    #import "Event.h"

Apple Objective-C programming fundamentals. Working with Data, Part 1, The App

This article will guide you to create an app that stores data on the user’s device. To create our sample app to store data on the user’s device

  • Start Xcode, the Apple IDE for IOS development
  • Create a new project
  • Open the AppDelegate.h file and enter the following into the @interface section before the @end
    @property (nonatomic, retain, readonly) NSManagedObjectContext *managedObjectContext;
    @property (nonatomic, retain, readonly) NSManagedObjectModel *managedObjectModel;
    @property (nonatomic, retain, readonly) NSPersistentStoreCoordinator *persistentStoreCoordinator;
    - (NSURL *)applicationDocumentsDirectory;
    - (void)saveContext;

    The lines above define three properties and two methods. The properties provide access to the Core Data framework of IOS, and the saveContext method will save you changes in the data file.

The Apple Core Data framework uses the following terminology

managed object

The table row

managed object context

Table rows that are in the memory and not saved to the database yet

managed object model

Describes the database, stores the relationships between the tables

entity description

Describes a table

persistent store coordinator

Manages a collection of persistent object stores, data files on the disk


  • In Xcode create a new class: RootViewController and make it the subclass of UITableViewController

xcode rootviewcontroller

  • Open the RootViewController.h header file and replace the content with the following
#import <CoreLocation/CoreLocation.h>

@interface RootViewController : UITableViewController  {

    NSMutableArray *eventsArray;
    NSManagedObjectContext *managedObjectContext;

    CLLocationManager *locationManager;
    UIBarButtonItem *addButton;

@property (nonatomic, retain) NSMutableArray *eventsArray;
@property (nonatomic, retain) NSManagedObjectContext *managedObjectContext;

@property (nonatomic, retain) CLLocationManager *locationManager;
@property (nonatomic, retain) UIBarButtonItem *addButton;

  • Open the RootViewController.m class file and add the following to the @implementation section
// Synthesize the properties to tell the compiler how to name them
@synthesize eventsArray;
@synthesize managedObjectContext;
@synthesize addButton;
@synthesize locationManager;
  • Write the Accessor Method for the Core Location Manager
// Create an accessor method to dynamically create the Core Location manager on demand
- (CLLocationManager *)locationManager {

    if (locationManager != nil) {
        return locationManager;

    locationManager = [[CLLocationManager alloc] init];
    locationManager.desiredAccuracy = kCLLocationAccuracyNearestTenMeters;
    locationManager.delegate = self;

    return locationManager;
  • Add the following two Core Location manager delegate methods
// Implement two delegate methods to enable and disable the Add button as appropriate.
// If the Core Location manager is generating updates, then enable the button;
// if the Core Location manager is failing, then disable the button
- (void)locationManager:(CLLocationManager *)manager
    didUpdateToLocation:(CLLocation *)newLocation
           fromLocation:(CLLocation *)oldLocation {
    addButton.enabled = YES;

- (void)locationManager:(CLLocationManager *)manager
       didFailWithError:(NSError *)error {
    addButton.enabled = NO;
  • Replace the implementation of viewDidLoad with the following:
- (void)viewDidLoad {

    [super viewDidLoad];

    // Set the title.
    self.title = @"Locations";

    // Set up the buttons.
    self.navigationItem.leftBarButtonItem = self.editButtonItem;

    // The viewDidLoad method needs to set up the Core Location manager and the Add and Edit buttons.
    addButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd
    target:self action:@selector(addEvent)];
    addButton.enabled = NO;
    self.navigationItem.rightBarButtonItem = addButton;

    // Start the location manager.
    [[self locationManager] startUpdatingLocation];
  • Implement Methods for Memory Management
// Replace the existing implementations of viewDidUnload and dealloc. The implementation of viewDidUnload // should relinquish ownership of anything created in viewDidLoad that can be recreated.
- (void)viewDidUnload {
    self.eventsArray = nil;
    self.locationManager = nil;
    self.addButton = nil;

Add the Navigation Bar to the top of the view

  • Open the Story Board in the Project Navigator
  • Select the FirstView
  • Drag a Navigation Bar to the top of the view from the Object library
  • Drag a Bar Button Item to the left side of the Navigation Bar and set the Identifier to Edit
  • Drag a Bar Button Item to the right side of the Navigation Bar and set the Identifier to Add

Configuring the Application Delegate

The application delegate is responsible for creating and configuring the root view controller and a navigation controller to contain it.

Add the Navigation Controller Property

    • In the application delegate’s header file (AppDelegate.h), before the @interface section add an instance variable:
      UINavigationController *navigationController;
    • Add the property declaration:
      @property (nonatomic, retain) UINavigationController *navigationController;


Implement the Application Delegate

In the application delegate’s implementation file (AppDelegate.m):

  • Before the @implementation block of the application delegate class, import the RootViewController class’s header file:
    #import "RootViewController.h"
  • In the @implementation block of the application delegate class, synthesize the navigation controller property:
    @synthesize navigationController;


  • Replace your application delegate’s application:didFinishLaunchingWithOptions: method with the following implementation:
    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
        RootViewController *rootViewController = [[RootViewController alloc]
        NSManagedObjectContext *context = [self managedObjectContext];
        if (!context) {
            // Handle the error.
        // Pass the managed object context to the view controller.
        rootViewController.managedObjectContext = context;
        UINavigationController *aNavigationController = [[UINavigationController alloc]
        self.navigationController = aNavigationController;
        [window addSubview:[navigationController view]];
        [window makeKeyAndVisible];
        return YES;

Apple Objective-C programming fundamentals. Working with Dates

When you need to display date and time on your app’s screen you need an easy way to convert NSDate objects to NSString objects. Objective-C  contains methods to do the conversion, but the syntax is not simple. It is much easier to create a method that does the conversion and call that in a central place.

Create a method to convert NSDate objects to NSString using the current date format of the device.

Add a new class to the project

  • Click the + sign in the lower left corner of the Project Navigator
  • Select New File… in the pop-up menu
  • Select IOS -> Cocoa Touch -> Objective-C class
  • Click the Next button
  • Enter CommonMenthods into the Class field
  • Select NSObject in the Subclass of list
  • Click the Next button
  • Click the Create button to save the file in the project folder

Add three method signatures to the CommonMethods class

  • Open the CommonMethods.h file
  • Insert the following code into the @interface section
    + (NSString *)getDateShortString:(NSDate *)date;
    + (NSString *)getTimeShortString:(NSDate *)date;
    + (NSString *)getDateAndTimeShortString:(NSDate *)date;

Add the three methods to the implementation file

  • Open the CommonMethods.m file
  • Insert the following code into the@implementation section of the file
    // Returns the short date as a string
    + (NSString *)getDateShortString:(NSDate *)date {
        NSString *stringFromDate = [NSDateFormatter localizedStringFromDate:date
        return stringFromDate;
    // Returns the short time as a string
    + (NSString *)getTimeShortString:(NSDate *)date {
        NSString *stringFromDate = [NSDateFormatter localizedStringFromDate:date
        return stringFromDate;
    // Returns the short date and time as a string
    + (NSString *)getDateAndTimeShortString:(NSDate *)date {
        NSString *stringFromDate = [NSDateFormatter localizedStringFromDate:date
        return stringFromDate;

To use the new methods

Make the methods available in the class

  • Import the CommonMethods.h file into the class where you want to use the method
  • Insert the following line under the existing #import statement
    #import "lpCommonMethods.h"

Call the methods

  • Use the following syntax to display the date and time in short format set by the user
    self.startDateLabel.text = [CommonMethods getDateAndTimeShortString:self.startDate];

    startDateLabel is a label on the view
    startDate is the NSDate object

Apple Objective-C programming fundamentals. Creating Segues in the Storyboard

Segue types

Segues are connections between views, so one view can call the other when the user pushes a button, or any specific object.

The Modal Segue

When the two views do not need to share information, like a login screen

The Push Segue

The push segue can pass data between the views and handle memory. This type of segue is needed for the navigation controller and tab bar controller.


Creating a Modal Segue

Add a button to the first view that will open the second view

  • In Xcode open the Storyboard of your application
  • Open the Utilities View in the upper right corner of the screen and select the Object libraryxcode object library
  • Drag a Text Field to the first view
  • Drag a Round Rect Button to the first view and enter Open Second Page as the title
    xcode first page

Add a new view to the Storyboard

  • From the Object library drag a View Controller to the storyboard
  • Drag a Text Field from the Object library to the second view
  • Drag a Round Rect Button from the Object library to the second view and enter Back to First Page to the title
    xcode second page

Create the segue between the views

  • Press the Control button on the keyboard and drag from the button on first view to the new view controller and release the control key and the mouse button
    xcode create segue
  • In the popup select modal
    xcode modal segue


Add the Text field to the interface of the first view

  • Open the ViewController.h of the new view in the Assistant Editor
  • Press the Control button and drag from the text field to the @interface section of the ViewController.h file
  • In the popup type firstTextField to the Name field and click the Connect button
    xcode first text field interface

Add the button to the interface of the first view

  • Press the Control key on the keyboard and drag the button from the first view to the @interface section of the ViewController.h file. Set the 
    • Connection to Action
    • Name to showSecondView: (including the colon)
    • Click the Connect button
      xcode first button interface

Create a a UIViewController class for the new View Controller

  • In the lower left corner of the project navigator click the plus sign (+)
  • Select New File... from the popup menu
  • On the popup window select Objective-C Class under IOS Cocoa Touch
  • Click the Next button
  • Set the name of the class to SecondViewController
  • Set the “Subclass of” to UIViewController
  • Click the Create button to place the new class into the project folder

Connect the new class to the View

  • Open the Storyboard and select the new view
  • In the Identity Inspector elect SecondViewController in the Class list


Add the Text field to the interface of the second view

  • Open the SecondViewController.h of the new view in the Assistant Editor
  • Press the Control button and drag from the text field to the @interface section of the SecondViewController.h file
  • In the popup type secondTextField to the Name field and click the Connect button
    xcode second text field interface

Add the button to the interface of the second view

  • Press the Control key on the keyboard and drag the button from the second view to the @interface section of the SecondViewController.h file. Set the
    • Connection to Action
    • Name to returnToFirstView: (including the colon)
    • Click the Connect button
      xcode second button interface