The Passioned Mobile DeveloperInterested Graphic Designer

Installing Phalcon on Mac OS X El Capitan without package manager

Phalcon is a full-stack PHP framework delivered as a C-extension. It's a really performant framework and I started to work with it while I was a student.

If you are using any package manager like Homebrew or Macport, it's pretty easy to install, you will `tap` or `brew` the right command (following the installation tips in their documentation).

But if for any reason you do not want to use package managers, you will have to install it from the sources. The installation require many developer tools running on your machine, and this tutorial gives you the different steps for a ready-to-go installation.

I. The classic web environment: MAMP

If you are installing Phalcon, you are probably going to make some web development right? So you should make a proper install of the classic tools: apache and php.

Fortunately, El Capitan comes with integrated php and apache versions (php 5.5.30 and apache 2.4.16 while writing) which are enough for phalcon installation. You can find your php and apache versions by running these commands:

If you want to upgrade them, there is tons of tutorials, but here we will use their integrated installation.

Ensure that apache is running with the following command:

$ sudo apachectl start

II. xCode and its command line tool

xCode is Apple's IDE providing a suit development tools for iOS and OSX development. It contain many tools (gcc, make, ...) you need as a developer and you can download it for free, but it's quite heavy and could be a real challenge for your nerves.

If you can't install it, get its command line tool by running the following command in your terminal:

$ xcode-select --install

You can check that you successfully installed it with the command:

$ xcode-select -p/Library/Developer/CommandLineTools

III. Autoconf

Autoconf is an extension of macros for helping your shell configuring some installation, Phalcon needs it and you have to install it. It can be done really easily by running the following commands:

And finally, you will have to create a symbolic link of your pcre.h file located in your pcre directory. El Capitan comes with its new System Integrity Protection (SIP) which prevent you from altering the /usr/local directory. So in order to perform our symbolic link, we will have to disarm the SIP

System Integrity Protection (SIP, sometimes referred to as >rootless) is a security feature of OS X El Capitan, if you decide to disarm it, be aware of it

To disarm the SIP, follow these steps:

Reboot your apple computer in recovery mode by holding Command + R

Open the terminal (Utilities > terminal)

Enter the following command : `csrutil disable`

Restart your computer

After you disabled it, you will be able to create your symbolic link by running the following command:

$ sudo ln -s /usr/local/pcre-*-**/include/pcre.h /usr/include/pcre.h

V. Phalcon installation

You are now ready to install Phalcon!

First, download the package with the following commands:

$ git clone --depth=1 git://github.com/phalcon/cphalcon.git

Go to the building directory and install it:

$ cd cphalcon/build$ sudo ./install

$ git clone --depth=1 git://github.com/phalcon/cphalcon.git

Once the installation is finished, add the phalcon extension to your php.ini (create it from php.ini.default if necessary):