I want to share with you my knowledge base system. I need one because there’s a lot of new information every day about the topics I care about (web development, design, Mac, iOS…). For a long time I searched for a good tool to store all my links, notes and micro tutorials I write for myself. Usually for my notes I use nvALT synced with Elements for iPad/iPhone over Dropbox, this is a great combo but lacks the organic order and power of a wiki. So I started using a personal wiki and I want to share how I use a web app in my Mac just as a native a app.

Why a wiki?

After years of testing applications I’ve noticed they all had something that made me look for different solutions, that thing was that all applications are designed to work with a workflow designed by the developer but not my own work flow. We all have different needs depending on our activities, although we all need to store information this information is varied and the way we need to organize and query it is also different. I discovered that a wiki is the most organic way to work because it allows users to create their own information system. For example, I have an HTML section on my wiki, every time I find a new article about HTML5 or a new framework it goes to that section. I have other sections like “CSS”, “WordPress”, “Git”, “PHP”, “Mac OS X”, “iOS”, etc. And this sections are linked between each other. This way I’m curating a personal knowledge base about things important for me personally and for my work. If you follow this instructions you’ll get a personal wiki running in your Mac as a native app. The process is a bit long but I promise that in the end you will have a great tool. Th is is a good weekend project, when you have enough time and wont be interrupted.

What do you need?

This solution will require us to install some apps in our Mac. At the end you’ll get a personal wiki that will behave as a native application on your Mac and will be simple to use, but before getting to that point you need the following:

  • DokuWiki (free web application)
  • MAMP (free native application)
  • Dropbox (free native application)
  • AppleScript Editor  (operating system application)
  • Keychain Access (operating system application)
  • Fluid (free native application)

Why DokuWiki?

The wiki you are going to install is a web application called DokuWiki, I chose this wiki for several characteristics and features that make it the best choice for this kind of use: its lightweight and simple, has a friendly user interface, has an easy to learn syntax and it doesn’t require a database, instead of database it operates through simple text documents. Another important aspect is that DokuWiki has a large base of users who have developed plug-ins and themes that enhance the functionality of the application. Lets get started:

1.- Dropbox

First you need to install Dropbox on your Mac by downloading it from the link above. To download and use the app you should create a free account in the Dropbox website. For now you will only install the application, it will be useful later but it is important to do this before the next step.

2.- MAMP

Now you must install MAMP downloading it from the link above, this is an application that allows you to run an Apache server with PHP in your Mac which you will need to run the wiki. DokuWiki is an application developed in PHP, as you know PHP is a scripting language running on the server side, this means that you need a server with PHP installed to run the scripts and the result is sent to your computer (the client). With MAMP your Mac will be both, the server and the client.

  • MAMP installation is simple because it has its own installer that does all the work for you, and removeing MAMP is easy as well, it only requires you to delete the MAMP application folder.
  • Once installed open MAMP and it requires you to type your password (the one you use in your Mac session), then a page will open in your browser, thats the control panel for your server, this means that the application is successfully installed.
  • Open MAMP preferences and they should look like this:
  • In the ports section you should press the button that changes the preset ports for Apache and SQL, so that they’re set as follows:
  • Finally make a change in the Apache section, here you are asked to select a directory, this directory should be the one where your wiki will live in. You can select one or create a new one but it is important that you choose one within Dropbox, for example here you can see I chose the directory:            /Users/carlos/Dropbox/DevProjects/PHP
Your directory should look something like this: /Users/xxxxxx/Dropbox/xxxxxx
  • Finally close and relaunch MAMP to ensure its still functioning properly.If in the beginning or after the configuration MAMP doesn’t open the page in the browser or the MAMP window indicators are in red instead of green it means that something is not working properly and there are thousands of different causes for this. If you require assistance please go to the MAMP forums or google it.

3.- DokuWiki

  • Now download and install DokuWiki. Once downloaded you must place the extracted files in the directory you chose in MAMP earlier.
  • Launch MAMP and in your browser enter this URL: http://localhost/xxxxxx/install.php where xxxxxx is the name of the directory where you moved the DokuWiki files to.
  • This is the install page for DokuWiki, here you’ll choose the name of the wiki and will set a user account. You’ll also have to choose if the wiki will be public or private. As this wiki will live in your Mac instead of the web you may choose to make it public or if you’ll keep confidential information in there you can make private to use a password.
  • When you finish the installation you’ll get to the main wiki page whose URL is http://localhost/xxxxxx/doku.php

At this point you’ll have a wiki running on your Mac, to learn more about how to configure DokuWiki, the syntax, plug-ins and themes visit the official site. Although this is already working you will need to do some more things to make it work like a native application. The following steps are optional but will allow the wiki to behave as an ordinary application in your Mac.

4.- Open MAMP without typing your password

Every time you open MAMP to start the Apache server it requires your password, it is also very annoying having to open MAMP every time you want to use your wiki. To solve this you will make a small application that will open MAMP each time you log on to your account without requiring a password.

  • First open the Keychain Access application that is found in the Utilities folder within the Applications folder.
  • Add a new element called MAMP with your session account and password and save it:
  • Now open AppleScript Editor found in the same directory as the previous application, there you are going to do a little script, this can be modified to suit your needs but if you copy and paste this code it will work perfectly:
on run
set theUserName to do shell script ("security find-generic-password -gl MAMP | grep \"acct\" | cut -c 19-99 | sed 's/\"//g'")
set thePassword to do shell script ("security 2>&1 >/dev/null find-generic-password -gl MAMP | cut -c 11-99 | sed 's/\"//g'")
do shell script "/Applications/MAMP/bin/startApache.sh &" password thePassword user name theUserName with administrator privileges
do shell script "/Applications/MAMP/bin/startMysql.sh > /dev/null 2>&1"
end run

Basically this script starts the MAMP server using your password in the Keychain Access app.

  • Now save the script as an application and name it something like “openMAMP” for example.
  • Move your application to the Applications folder and add it to your login items by entering to your account settings in the system preferences, this way your little script will run every time you log on:
  • Finally restart your computer. It is assumed that after the restart when logging to your session the script will run and it will start your local server. There will be no application running but the server will be running, thereby also you get rid of the MAMP icon constantly appearing on your Dock.
  • To test that everything is working fine enter the address of your wiki in the browser: http://localhost/xxxxxx/doku.php If all went well the wiki should open without launching MAMP.
Until now you have a local server running constantly and you can access your wiki easily through the browser but I promised it would work like a native application so there is still another step.

5.- Fluid

Fluid is an application that lets you make dedicated browsers to run web apps like native applications that can be launched from an icon in your Mac. It is basically a Cocoa wrapper for a website.
  • Once you download Fluid make a new dedicated browser using the URL of your wiki, choose the name you want and you can even choose an icon for the browser:
  • Fluid will create an icon in your applications folder that you can drag to the Dock, now whenever you want to open your wiki, just launch your wiki browser and voila!, you are running a web application hosted locally in your Mac as if it were a native application.
After all this process you finally have your personal wiki up and running on your Mac using DokuWiki which is a very powerful platform, yet very simple. So far it’s a great achievement but this workflow is so versatile that there are still more things you can do:

In your office

  • If you have an office with several computers connected to the same wireless network everyone can access the wiki. Simply choose a computer to run the server and you can connect to the wiki from the browser in other computers using the IP of the server computer and the directory the wiki is hosted in, for example:
  • This way you can have a wiki for your little company running on the local network.

In iOS

  • In the same way as in the previous example you can access the wiki from your iPad or iPhone browser while connected to the same wireless network than the computer running the server.
  • There is also a way to check your information on the wiki while away from your home or office, you just have to install the Dropbox application in your iPad or iPhone and use the simple text documents DokuWiki generates. The path where these documents are located in Dropbox will be: /Dropbox/xxxxxx/data/pages where xxxxxx is the directory where your wiki is hosted. This is one of the reasons why you used Dropbox. In addition each document marked as “Favorite” in Dropbox for iOS will be stored offline.

Extending the functionality of your wiki

As I mentioned at the beginning one of the advantages of DokuWiki is that it has plug-ins that can extend its functionality, some I recommend are these:

You see, an essential part of this workflow is the use of Dropbox so you can check your information from any computer with Internet access or even from your iOS devices offline. Another advantage of Dropbox is that your wiki is backed up online, if something happens to your hard drive you wont loose all your knowledge base. Also another key is that the DokuWiki pages are saved as simple text and thanks to the simplicity of its syntax you can read them as text without problem.

If you have more uses for this system share your ideas and tricks …