Git Completion with Terminal/iTerm output theme

Install Git Completion:

Save the git-completion.bash file in your home directory:


Open your .bash_profile

nano ~/.bash_profile

Paste the following at the top of the file, make sure not to overwrite any other settings you may have put in the file.

###### GIT COMPLETION - START ######
parse_git_branch() {
    git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ \1/'

# Colour Variables
LIME_YELLOW=$(tput setaf 190)
POWDER_BLUE=$(tput setaf 153)

# Define the terminal output string: username in path - branch
export PS1="${REDBOLD}\u ${RESETCOLOR}in ${CYANBOLD}\w ${GREEN}-\$(parse_git_branch)${RESETCOLOR} $ "

# Include the git completion file (must be saved in your home directory for this to work)
# Source:
if [ -f ~/.git-completion.bash ]; then
 . ~/.git-completion.bash

 # Add git completion to aliases
 __git_complete gco _git_checkout
 __git_complete gb _git_branch
 __git_complete gc _git_commit
###### GIT COMPLETION - END ######

Reload .bash_profile

source ~/.bash_profile
OSX Web Development

Simpler way of adding for CakePHP3 on OSX with Mamp

In a Nutshell we just need to do get the full binary package of PHP and install it on OSX, this version comes with, and we will copy it out of its install directory and drop it into our PHP version.

Get & Install the Binary Package

This website provides the packages so we just pick the version we want to use and run their install script:

curl -s | bash -s 5.6

This would install php 5.6 and we we can copy the file out of the install directory and drop it in our PHP folder.

PHP 5.6.31:

cp /usr/local/php5-5.6.31-20170817-164511/lib/php/extensions/no-debug-non-zts-20131226/ /Applications/MAMP/bin/php/php5.6.31/lib/php/extensions/no-debug-non-zts-20131226

In this example I am using Mamp so I should drop it into the extensions/no-debug-non-zts-20131226 folder of my PHP version.  These are the same version of PHP so the path should be the same, its just that Mamp holds its PHP binary files in the MAMP app.

PHP 7.3.8:

cp /usr/local/php5-7.3.8-20190811-205217/lib/php/extensions/no-debug-non-zts-20180731/ /Applications/MAMP/bin/php/php7.3.8/lib/php/extensions/no-debug-non-zts-20180731/


Enable the extension

Find the php.ini file for the version of php you want to use in my case I was using php5.6.31 (you can tell from copy/paste terminal line), and under “Extensions” add the line:

And restart Mamp, and your extension should now be installed!

Set PHP version for Terminal – Required for CakePHP / Composer based installs

Frustratingly, terminal often runs a different version of PHP when installing with composer, so for example, CakePHP refuses to install because its running a version of PHP that doesn’t have installed.  Check your version of PHP in terminal by typing:

php -v

if it is a different version that the one you want, set the correct one by using an alias in your .bashrc file.

sudo nano ~/.bashrc

Add the line (Replace php path with your path):

alias php="/Applications/MAMP/bin/php/php5.6.31/bin/php"

Then finally reload your bashrc file with:

source ~/.bashrc

You also may need to use this guide to include the php version to terminal if the above doesn’t work:


OSX Web Development

Install ext-intl on Mac OSX using homebrew and XAMPP

This was a painful process for me, it took quite a while to figure out why such a simple implementation when using ubuntu, can be so much work in a Mac.

We can’t just install the extension with apt-get like ubuntu, and its not already waiting to be uncommented like in windows, we have to install the the shared object our selves.  and the easiest way of doing this is by using homebrew and pecl.

Step 1 – Install Homebrew

Homebrew Website:

/usr/bin/ruby -e "$(curl -fsSL"

Step 2 – Install Install icu4c

ICU4C Website:

brew install icu4c

Step 3 – Install Autoconf

More about Autoconf:

brew install autoconf

Step 4 – Install Intl via PECL

PECL Website:

sudo pecl update-channels
sudo pecl install intl

Step 5 – Enable in php.ini

Go to your php.ini file and at the end, add the following line:

This will enable the extension that we have just installed.

Step 6 – Restart your server

Use XAMPP to restart your server, this will reload the php.ini file with the new configuration.

Step 7 – Check it worked!

You can check if Intl was installed successfully by using the following command to list the loaded php modules.  If ‘intl‘ it is listed then it has been successfully loaded.

php -m

I am running php via Terminal and it didn’t work?

One common problem is that terminal is using the the wrong version of php, sometimes a system default is loaded rather than the php version you are using in XAMPP.  First lets check what version we are using:

which php

If you are using XAMPP correctly it should return:

  • /Applications/XAMPP/xamppfiles/bin/php 

If not and it loads from:

  • /usr/bin/php

Then we can temporarily change the path of the default php version to the XAMPP version by running the following in terminal:


Now if you run “which php” in terminal again you should get the correct path.