Hosting your own private Cloud-Storage Server isn’t that hard. This Tutorial is about installing an ownCloud Server on OS X 10.11 EL Capitan as Dropbox- / Onedrive- / Googledrive- Alternative.

ownCloud OS XServer

ownCloud made a massive development from the Beginning to the current Version. It has Sync-Clients for all major Operating Systems and Apps for Mobile Clients. iOS Users get the Integration / Access to Files into the System like Accessing / Up- and Downloading Pictures and Videos and to files with Apps like Office 365 etc.

While OS X already has all the Components needed, this Article is about installing a seperate Instance of the required Components (Apache, MySQL, PHP).


ownCloud is not official supported on OS X because of Issue #2377 german “Umlaut” / UTF-8 Problems, but these Problems are not reproduceable for me with this Installation – so i think it’s worth to try. Anyway – use this “as always” at your own risk, make backups of your data and do sufficient tests before using it for productive environments.



“Brew” Package Manager

First you’ll need to install “brew”. Brew is a Package Manager for OS X – if you don’t already have it, install it by firing up a Terminal (Applications>Utilities>Terminal) and entering:

ruby -e "$(curl -fsSL"

Check if brew is ready:

brew doctor

You should also check if brew is up-to-date:

brew update

Update brew and installed packages with:

brew upgrade



MySQL is our Database-Server which will host our ownCloud Database later. Brew it with:

brew install mysql


We need to add other repos (called “taps” in brew), to get a more updated version of Apache:

brew tap homebrew/dupes
brew tap homebrew/apache

Now let’s install apache:

brew install -v httpd22 --with-brewed-openssl


PHP is a sripting Language – It’s essential to get ownCloud working:

Add the repository first:

brew tap homebrew/php

I got a lot of Problems with “FPM”. In most cases it / resp. PHP was crashing on heavy load while syncing a lot of files, so i decide to install PHP without FPM:

brew install -v php55 --homebrew-apxs --with-apache --without-fpm

I got also Problems with the Pear-Lib and with some Permissions after trying to install additional packages – So this is the command how i it’s fixed (thanks to Alan Iveys Blog Entry here):

touch $(brew --prefix php55)/lib/php/.lock && chmod 0644 $(brew --prefix php55)/lib/php/.lock

Install some additional PHP Modules which will be needed for ownCloud later:

brew install -v php55-opcache
brew install php55-apcu
brew install mcrypt
brew install php55-mcrypt --without-homebrew-php
brew install php55-intl --without-homebrew-php


We will install a SSL Certificate directly – So all connections between the ownCloud Server and Client will be encrypted. If you don’t have an SSL Certificate, you can create your own:

openssl genrsa -des3 -passout pass:x -out server.pass.key 2048
openssl rsa -passin pass:x -in server.pass.key -out server.key
openssl req -new -key server.key -out server.csr

Keep the Password Prompt empty and just hit enter. You can raise the “-days” parameter to keep your certificate longer valid:

openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt

Create a new directory for your Certificate and Keyfile:

mkdir /usr/local/etc/apache/2.2/ssl

Copy your Key and Certificate to the destination:

cp server.crt /usr/local/etc/apache/2.2/ssl/server.crt
cp server.key /usr/local/etc/apache/2.2/ssl/server.key




Edit Apaches SSL-Configuration File:

nano -w /usr/local/etc/apache/2.2/extra/httpd-ssl.conf

And check if the red marked Parameters point to your .crt and .key file and are uncommented:

# Server Certificate:
# Point SSLCertificateFile at a PEM encoded certificate. If
# the certificate is encrypted, then you will be prompted for a
# pass phrase. Note that a kill -HUP will prompt again. Keep
# in mind that if you have both an RSA and a DSA certificate you
# can configure both in parallel (to also allow the use of DSA
# ciphers, etc.)
# Some ECC cipher suites (
# require an ECC certificate which can also be configured in
# parallel.
SSLCertificateFile "/usr/local/etc/apache2/2.2/ssl/server.crt"
#SSLCertificateFile "/usr/local/etc/apache2/2.2/server-dsa.crt"
#SSLCertificateFile "/usr/local/etc/apache2/2.2/server-ecc.crt"
# Server Private Key:
# If the key is not combined with the certificate, use this
# directive to point at the key file. Keep in mind that if
# you've both a RSA and a DSA private key you can configure
# both in parallel (to also allow the use of DSA ciphers, etc.)
# ECC keys, when in use, can also be configured in parallel
SSLCertificateKeyFile "/usr/local/etc/apache2/2.2/ssl/server.key"
#SSLCertificateKeyFile "/usr/local/etc/apache2/2.2/server-dsa.key"
#SSLCertificateKeyFile "/usr/local/etc/apache2/2.2/server-ecc.key"



Edit PHPs Config-File

nano -w /usr/local/etc/php/5.5/php.ini

And look for the following parameters. Set the Parameters to your needs – the Explanation of each Parameter can be found next to the Parameter. This are my settings:

upload_max_filesize = 250M
max_file_uploads = 50
default_charset = "UTF-8"
post_max_size = 0
default_socket_timeout = 3000
mysql.connect_timeout = 120
error_log = /usr/local/var/log/php-error.log



While we are creating a config from scratch, move/rename the old to a config backup file.

mv /usr/local/etc/apache2/2.2/httpd.conf /usr/local/etc/apache2/2.2/httpd.old 

Now edit the Main- Config-File:

nano -w /usr/local/etc/apache2/2.2/httpd.conf

Add the following Configuration to your empty Config-File. Change the red marked Parameters to your needs:

ServerRoot "/usr/local/opt/httpd22"

ServerName localhost
Listen 8080

User daemon
Group daemon


LoadModule authn_file_module libexec/
LoadModule authn_dbm_module libexec/
LoadModule authn_anon_module libexec/
LoadModule authn_dbd_module libexec/
LoadModule authn_default_module libexec/
LoadModule authz_host_module libexec/
LoadModule authz_groupfile_module libexec/
LoadModule authz_user_module libexec/
LoadModule authz_dbm_module libexec/
LoadModule authz_owner_module libexec/
LoadModule authz_default_module libexec/
LoadModule auth_basic_module libexec/
LoadModule auth_digest_module libexec/
LoadModule cache_module libexec/
LoadModule dbd_module libexec/
LoadModule dumpio_module libexec/
LoadModule reqtimeout_module libexec/
LoadModule ext_filter_module libexec/
LoadModule include_module libexec/
LoadModule filter_module libexec/
LoadModule substitute_module libexec/
LoadModule deflate_module libexec/
LoadModule log_config_module libexec/
LoadModule log_forensic_module libexec/
LoadModule logio_module libexec/
LoadModule env_module libexec/
LoadModule mime_magic_module libexec/
LoadModule cern_meta_module libexec/
LoadModule expires_module libexec/
LoadModule headers_module libexec/
LoadModule ident_module libexec/
LoadModule usertrack_module libexec/
LoadModule unique_id_module libexec/
LoadModule setenvif_module libexec/
LoadModule version_module libexec/
LoadModule proxy_module libexec/
LoadModule proxy_connect_module libexec/
LoadModule proxy_ftp_module libexec/
LoadModule proxy_http_module libexec/
LoadModule proxy_scgi_module libexec/
LoadModule proxy_ajp_module libexec/
LoadModule proxy_balancer_module libexec/
LoadModule ssl_module libexec/
LoadModule mime_module libexec/
LoadModule dav_module libexec/
LoadModule status_module libexec/
LoadModule autoindex_module libexec/
LoadModule asis_module libexec/
LoadModule info_module libexec/
LoadModule suexec_module libexec/
LoadModule cgi_module libexec/
LoadModule cgid_module libexec/
LoadModule dav_fs_module libexec/
# LoadModule vhost_alias_module libexec/
LoadModule negotiation_module libexec/
LoadModule dir_module libexec/
LoadModule imagemap_module libexec/
LoadModule actions_module libexec/
LoadModule speling_module libexec/
LoadModule userdir_module libexec/
LoadModule alias_module libexec/
LoadModule rewrite_module libexec/
LoadModule php5_module /usr/local/Cellar/php55/5.5.30/libexec/apache2/

SSLEngine on
SSLCertificateFile /usr/local/etc/apache2/2.2/ssl/server.crt
SSLCertificateKeyFile /usr/local/etc/apache2/2.2/ssl/server.key

DocumentRoot "/usr/local/var/www/htdocs"

<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all

<Directory "/usr/local/var/www/htdocs">
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all

ErrorLog "/usr/local/var/log/apache2/error_log"
LogFormat "%h %l %u %t \"%r\" %>s %b" common
CustomLog "/usr/local/var/log/apache2/access_log" common

AddHandler php5-script .php
AddType text/html .php
DirectoryIndex index.php index.html

<IfModule mod_headers.c>
Header always set Strict-Transport-Security "max-age=15768000; includeSubDomains; preload"
<IfModule mod_headers.c>

Service Setup


Make sure the Folder “LaunchAgents” exists in your Users Library Folder before you continue (Thanks to Daniel Neuwirth for this Hint):

ls -l ~/Library/ | grep LaunchAgents

This should output something like “drwxr-xr-x   10 user  staff   340  4 Mar 19:28 LaunchAgents“. If there is no output you’ll need to create the Folder first:

mkdir ~/Library/LaunchAgents


The next command will let PHP Autostart at Login:

ln -sfv /usr/local/opt/php55/*.plist ~/Library/LaunchAgents

Afterwards this command will start PHP now:

launchctl load ~/Library/LaunchAgents/homebrew.mxcl.php55.plist


This command will let Apache Autostart at Login:

ln -sfv /usr/local/opt/httpd22/*.plist ~/Library/LaunchAgents

Let’s launch Apache now:

launchctl load ~/Library/LaunchAgents/homebrew.mxcl.httpd22.plist


Adding MySQL to Autostart:

ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents

Launch mysql now:

launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist


Finalizing / Testing

MySQL Password

Set a password for mysql. The default Password after the Installation is empty, so just hit return if asked and enter your new password afterwards.

mysqladmin -u root -p password

Testing MySQL

Try to login to mysql with your new password:

mysql -u root -p

If everything goes alright exit it by entering “quit”.

Testing Apache

Open a Webbrowser and enter the URL: https://localhost:8080 – You’ll be prompted to Accept your self-signed Certificate. Accept this and you should see the Apache Test-Page.

Testing PHP

Create a new file called phpinfo.php:

nano -w /usr/local/var/www/phpinfo.php

Add the following Code to the file:


Save and quit the file. Open the new created file in your browser now: https://localhost:8080/phpinfo.php – You should see now an Information-Page about your PHP-Configuration and it’s environment.

(Optional) Reboot Test

Sounds strange but sometimes things go wrong after a reboot – so no fear – reboot your system if possible and check if still all services are OK.


Intermediate result

You have now a complete MAMP Environment and we are ready to install ownCloud now. Continue with Part 2, to get the ownCloud installation done. Please have a look at the Troubleshooting point if you got problems with the Testings before – If a service is faulty you should try to get it fixed before you continue.

ownCloud Server Installation

We need to create a database first.

mysql -u root -p

CREATE USER 'owncloud'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON owncloud.* TO 'owncloud'@'localhost' IDENTIFIED BY 'password';


Go to and download. In my Case i downloaded owncloud 8.1.3. The extracted package should give you a folder “own cloud”. Move the folder to your web servers root directory.

mkdir /usr/local/var/www/htdocs/apps

mv owncloud/ /usr/local/var/www/htdocs/apps/

Fire up the browser on the Server now with “https://localhost:8080/apps/owncloud”. Enter a Username and Password you like and change the Database Configuration to “MySQL / MariaDB”. Enter the Database user “owncloud” with the chosen password. You’ll be logged on to ownlCloud afterwards automatically.

Database Config

Edit the Configuration File after the Setup is done:

nano -w /usr/local/var/www/htdocs/apps/owncloud/config/config.php

Add the following line to the End of the Configuration-File to enable Caching:

memcache.local' => '\OC\Memcache\APCu',


ownCloud Client Config

You can now install the ownCloud Client on your Machine to sync files. If you receive an Error-Message here – check if you Hostname is added to the Config-File (see Troubleshooting-Part > ownCloud at the End of this Tutorial).

ownCloud Client Setup



Apache / Webservices

Check if apache is running:

Try to open it via a browser (https://localhost:port;

Check if the Service is running

ps ax | grep apache

Check if your Apache-Config has syntax errors:

apachectl -t

You can read the Apache Logs, especially the Error_Log with the following command:

cat /usr/local/var/log/apache2/error_log

The Access_Log will help you to find errors while opening Webpages:

cat /usr/local/var/log/apache2/access_log


You can read the PHP-Error log with the following command:

cat /usr/local/var/log/php-error.log

Also have a look at the before created phpinfophp to check if necessary Modules are loaded etc. (Browser: https://localhost/phpinfo.php).



If you receive the message that you are accessing the server from an untrusted domain, you can fix it by adding your hostname (DynDNS, IP-Addresses) to the ownCloud Config-File.

ownCloud Trusted Webpage Error

Edit the Config-File with:

nano -w /usr/local/var/www/htdocs/apps/owncloud/config/config.php

Add new Hostnames / IPs: Look for the “trusted_domains” segment and add +1 line to the array – don’t foget to close the line with “,” – See example:

'trusted_domains' =>
array (
0 => 'localhost:8080',
1 => '',
2 => '',


  • Daniel Neuwirth


    The next command will let PHP Autostart at Login:

    ln -sfv /usr/local/opt/php55/*.plist ~/Library/LaunchAgents

    This command destroys the LaunchAgents directory, because you have forgot to add a slash at the end. should be:

    ln -sfv /usr/local/opt/php55/*.plist ~/Library/LaunchAgents/

    same thing with apache and sql:Apache

    This command will let Apache Autostart at Login:

    ln -sfv /usr/local/opt/httpd22/*.plist ~/Library/LaunchAgents
    > should be ln -sfv /usr/local/opt/httpd22/*.plist ~/Library/LaunchAgents/
    Let’s launch Apache now:

    launchctl load ~/Library/LaunchAgents/homebrew.mxcl.httpd22.plist


    Adding MySQL to Autostart:

    ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents
    should be : ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents/

    thx for the great tutorial

    • joh

      Thanks Daniel – Added your Hint to the Tutorial. Greetings – joh

  • ChaosARG

    Hi, thanks for the guide!
    Is there any way to achieve this with OS X installed? Since that already has Apache and can work with the GUI to make modifications, also using the same directory as for the websites

    • joh

      Hi – it’s possible with some hacks and i believe there are Tutorials around. The main Problem is offically owncloud Server is not supported on OSX. Apple delivers a very custom setup with the . The Packages like Apache, PHP etc. are not up to Date and preconfigured to work well with the GUI. In my tests i got Performance Problems and Malfunctions with owncloud with the Setup which weren’t possible to fix due to bugs in Apples older Packages. There are also ways to update Apples Apache version and Components but you never know what this will break. There is also no big community around this so it’s also hard to find help/support for customizations of the default Apple Components … So thats the Point why i decided to go with the isolated Setup…

      • Javier Gonzalez

        I have gotten it working upgrading php to 7 and using redis cache. Using the server app changes the files locations and the config files but it’s not impossible. Will see if can reproduce in a VM and post instructions

        • Ruben Härtel

          how did you upgrading php to 7 and used redis cache?

          • Javier Gonzalez

            getting php 7 and redis working is fairly straightforward with home brew. “brew install –HEAD php70-redis”
            You have to modify the custom httpd files as described here:


            You have to adust the paths to your specific situation.

            Make sure you back up the source files and that things survive a reboot.

          • Ruben Härtel

            Hi Javier
            That is what I have been trying so far. But if I get on the default web page in the and open in that directory the info.php, it still shows that only php 5.5.34 has been loaded even though I get a correct status of php 7 in terminal. What is wrong with it?

  • Zsolt

    I just wanted to thank for the guide and add a few of my observations: I have a mini server running Yosemite and MAMP Pro 3.2.1. Neither with server’s web deployment, nor with MAMP did it work properly. I would manage to get the login page and even login but it would report consistency problems and I could not get to any other page. On the other hand, with the procedure here it worked, kind of…
    There were two things which did not work: the sql server would not allow me to set the password, it would report logon failure, and apache did not start.

    The first one I solved by forcing password reset by specifying password set in the init file and adding the init file parameter to the launchd startup parameter file

    The second by starting the apache as specified in the launchd parameter file directly from the terminal and checking the errors it was giving, it was always a missing file or folder

    /usr/local/Cellar/php55/5.5.30/libexec/apache2/ the folder was 5.5.33 so I created a link for 5.5.30 pointing to 5.5.33

    then it was looking for certificates with certain name (as specified in the httpd config file)

    SSLCertificateFile /usr/local/etc/apache2/2.2/ssl/
    SSLCertificateKeyFile /usr/local/etc/apache2/2.2/ssl/
    the files were named server.crt and server.key

    again I just created a softlink with ln -s

    finally, the document root was not in /usr/local/var/www/htdocs and not in htdocs/apps, so I had to move the unpacked owncloud folder into htdocs not into htdocs/apps

    Now I’m struggling with trusted domain, the localhost works but nothing else, in spite of updating the config file, I found it reported for version 9 as bug for nonstandard ports (not sure if 8080 is considered nonstandard for own cloud) but could not fix it yet.

    Thanks again for the instructions


    Update, I fixed the trusted domain problem now as described here

    by adding the

    // Compare with port appended
    if(in_array($domainWithPort, $trustedList, true)) {
    return true;

    to the trustedomainhelper.php file

  • Vercety87

    Hi thanks for your tutorial.

    I try to do this on my iMac but when I try to start apache I have this error:

    httpd (no pid file) not running

    Any idea with this error?


    • joh


      it seems the Webserver Service (Apache) is not running. You can check the Service for errors by typing:

      cat /usr/local/var/log/apache2/error_log

      Also check if you get errors when you try to start Apache manually:

      launchctl load ~/Library/LaunchAgents/homebrew.mxcl.httpd22.plist

      Good Luck 😉

  • kinobijei

    Good morning, I’ve problems with growing number of apache httpd processes. I think this can ben fixed by applying the mpm prefork module. but does it come with the homebrew apache installation? Where can I find it in order to install it and point to it into my httpd.conf file?

    • joh


      i believe “prefork” is the default in the brew package – as i see it’s an compile option – so the only parameter you’ll need is “MaxSpareServers” in your httpd.conf if you would like to play around with.

      I remember getting issues with some old versions of apache and php crashing one of both servers on heavy up- and downloads by the owncloud client, especially when i used apples built-in apache an php. In my case this was fixed with the latest versions of apache and php from brew and disabling fpm in php (like described in the tutorial).

      I analyzed the problem by syncing lots of files with the owncloud client and checking the processes on the Server. Also setting the log level higher and checking the logs at the point of crash should help you.

      Since this tutorial is now +1 year and i’m running still the same configuration on El Capitan, i can not say it will work on Sierra if you are using this… i’m planning to upgrade sierra with the next service pack – I have still probs with my macbook and sierra – so i believe it will not be the best choice as my productive server at the moment…

      Anyway … hope this helped a litte bit or gave an idea where to start finding out the problem …