Monday, 24 March 2008

Howto install KILE on Mac OS X natively

Mission: install Kile on Mac OS X, natively, no X11 emulation
Even though kde4 made me reconsider positively the gnome desktop environment, the aspect i like most is the possibility of installing kde apps on non linux systems!
and one of the aspects i love of mac is that almost any linux program can be installed!
However when you use a lot a program it can become annoying that you have to run X11 first, then start the app from command line and in the end you get a program not very well integrated with the system.
So i though i could compile the necessary libs for installing my favourite kde application: KILE
which for me is the _best_ latex editor.
You can use it with X11 all the way, but if you want more, follow this guide.

0. The easy wayThere is a shortcut to almost all the procedure described, that is, download and install the snapshots of Racoon Fink and compile kile like in section 3; however the svn versions usually work better when they are all svn, mixing version may produce unexpected surprises.
So if you want the quick (so to speak since you're gonna download ~3GB from torrents) and easy way follow the guide located here and proceed to section 3; for the bravest of you out there continue reading.
If you wish, you can test both methods on the same machine as they won't interfere.

1. Requirements
If you want the latest release of kde, you are very brave, or you want to learn something, this is the right path!

1.1 Fink
So first of all you need fink which is a nice easy and clean way to obtain all the basic dependecies we need. As a general rule, when you're missing some program or lib, just type

fink install
and you are ready to go!
I'm not covering how to install fink (because it is really simple) nor which dependency you actually need (because i don't know, as i believe i've installed almost any packet fink offers :P) [but you can see here some hints]

1.2 QT (updated)
Then you surely need QT-4.4, which recently exited beta, any previous version won't work. To make things easier you can directly take the qt-copy package, a patched version of qt for compatibility with KDE.
So obtain the patches from svn with
svn co svn://
Access the directory and then compile and install
./configure -dbus-linked -no-accessibility -no-qt3support -optimized-qmake -no-3dnow -qt-gif -release -prefix /opt/qt4.4 -openssl make sudo make install
I put quite parameters trying to tweak performance a little bit. If you want to go in details:
  • -dbus-linked is needed by latest release, or kdelibs will complain
  • -no-accessibility since we're install qt for kile we can set this off, but it can be useful for some other applications
  • -no-qt3support as qt3 works with X11 only, it's something we can deactivate
  • -optimized-qmake should turn on some random optimizations
  • -no-3dnow only available in AMD cpu
  • -qt-gif was present in the official guide, so it shouldn't be harmful :P
  • -release removes unnecessary debug symbols (don't do this if you want to develop on the qt!)
  • -prefix /opt/qt4.4 i want third party stuff installed in /opt to resemble a Linux fs :)
  • -openssl for some strange reasons, kdelibs won't start compiling if openssl not enabled in this way
1.3 CMake
One last requirement is CMake (>2.7) that you can obtain with the following commands
(if asked for a password type "cmake")
cvs -d login cvs -d co CMake
and compile as usual
cd CMake ./configure --prefix=/opt/kde4-deps-svn make sudo make install
2. Installing KDE4 You need a couple of packets before we can install kile: kdelibs, kdepimlibs and kdebase.Optionally you can install kdesupport which contains soprano, strigi and some other dependency we might need later. One important step is to configure correctly the necessary environment variables. As a minimum you need to do
export PATH="/opt/qt4.4/bin:/opt/kde4-svn/bin:/opt/kde4-deps-svn/bin:/opt/fink/bin:$PATH" export CMAKE_LIBRARY_PATH="/opt/kde4-deps-svn/lib:/opt/fink/lib" export CMAKE_INCLUDE_PATH="/opt/kde4-deps-svn/include:/opt/fink/include" export PKG_CONFIG_PATH="/opt/qt4.4/lib/"
(i installed fink in /opt/fink, change your variables accordingly) 1.1 kdelibs For me kdelibs was the most difficult part of the whole process because for some reason it did not compile easily; however after some checkouts later it did compile with no problems. As usual perform
svn co svn://
and in the same directory where you run that command
because cmake wants to build stuff in a separate folder from the source and the .build will keep spotlight indexing away. Now run
cd cmake ../kdelibs -DCMAKE_INSTALL_PREFIX=/opt/kde4-svn -Wno-dev -DCMAKE_BUILD_TYPE=Release sudo make install
1.2 kdepimslibs Then the other parts are quite straightforward, apart some dependecy missing. So let's fix them first: do
fink install gpgme11 boost1.33
while the rest is just like before
svn checkout svn:// mkdir cd kdepimlibs.buildcmake ../kdepimlibs -DCMAKE_INSTALL_PREFIX=/opt/kde4-svn -Wno-dev -DCMAKE_BUILD_TYPE=Release sudo make install
1.2 kdebase This one was a little tricky because for a bug it says Blitz is missing while in reality it wants qimageblitz!If you installed kdesupport you should already have this, but for all the others, do
svn checkout svn:// mkdir cd qimageblitz.buildcmake ../qimageblitz -DCMAKE_INSTALL_PREFIX=/opt/kde4-deps-svn -Wno-dev -DCMAKE_BUILD_TYPE=Release sudo make install
Note that this is being installed in the -deps folder; if you want to use the whole kdesupport, remember to install it there! For those who didn't install kdesupport, remember that strigi and soprano are required for this packet! Now we can install our nice kdebase, the last requirement for Kile! We don't need it whole, just the runtime and optionally the apps part! Just perform
svn checkout svn:// mkdir cd kdebase-runtime.buildcmake ../kdebase/runtime -DCMAKE_INSTALL_PREFIX=/opt/kde4-svn -Wno-dev -DCMAKE_BUILD_TYPE=Release sudo make install cd .. mkdir cd kdebase-apps.buildcmake ../kdebase/apps -DCMAKE_INSTALL_PREFIX=/opt/kde4-svn -Wno-dev -DCMAKE_BUILD_TYPE=Release sudo make install
and you can successfully proceed to step 3! 3. Kile, finally! Now that we've got everything we need, we can happy download and install Kile natively, without X11 emulation! The svn reported on the website is for the stable branch, we're going to need something more extreme! Obtain the source from
svn co svn://
and compile it like you did with every packet till now
mkdir cd kile.buildcmake ../kile -DCMAKE_INSTALL_PREFIX=/opt/kde4-svn -Wno-dev -DCMAKE_BUILD_TYPE=Release sudo make install
Now go to /opt/kde4-svn/bin and there you will find your Kile app, ready to be run! You can move it into the Application folder to get along with the other apps and use this nice icon to flavor it up! 4. Be happy (almost) We're done! we have our favourite app running natively on our computers! Wait something is missing! The quickbuild & co. don't seem to work! Yep that's because mac are a little different from linux apps and it's more difficult to set up a correct environment for them! But do not worry! there is a solution for anything! Download and install Platypus from here. This tool is a wrapper for mac application to behave like real bsd programs! I'll describe the simple step to make our kile fully running, for more information, visit the site at the end of this guide. Open Platypus, give a name to the application (namely, Kile), select Shell script type and choose a new Script Path. In the editor that appears you have to write your path you have set in the everyday bash (echo $PATH) and the command line call for kile. Since we're going to use this script for launching kile i suggest you move the Kile app in the Application folder to somewhere you don't visit often, like Utilities/TeX (at least, that's were i put it mine). Now write in the editor
#!/bin/bash export PATH="(your path here)" /Applications/Utilities/TeX/
ans press Save. Now, before clicking Create, select the option "Runs in background" so we won't have the script icon hanging in the Dock. All done! Click Create, put a nice icon to the script (the one of before) and here we go! A fully working Kile editor! Remember that there's still some tuning to do, like setting the Preview application instead of kpdf, but after compiling half kde i'm sure you're willing to perform this last step :) Hope you enjoyed this little guide and if you liked it, you can publish it anywhere you want as long as you link it here! If you find some errors or don't like something, please contact me or leave a comment! PS Credits: here is the two guides i took most of for writing mine


  1. oh! inizi a produrre documentazione per gli amici linuxiani :D bravo koda!!!

  2. Does this method work in Leopard? I can't even install fink in the first step~~~

  3. Read on the fink homepage:
    "Important Note for Leopard Users: There is not currently a binary release for you. Please go to the source release page." :-)

  4. Nice! and thanks for this! Notice though that you have to build before installing, so `make' before `sudo make install'.

  5. I've updated the QT part now that kde4.1 is in beta.

    Thanks for the comments above :)
    however if you type "make install" without running "make", it automatically builds the code first, and then proceeds to installation without user interaction!

  6. Nice job!
    I was using kile using X11, it works fine except that the copy/paste function from Mac Apps to Kile doesn't work. I seems that when you install kile natively (following the steps in this entry), the function should work, could you confirm?

  7. I've tried today and failed to compile kdelibs:

    cmake ../kdelibs -DCMAKE_INSTALL_PREFIX=/opt/kde4-svn -Wno-dev -DCMAKE_BUILD_TYPE=Release
    -- Found Qt-Version 4.4.0 (using /opt/qt4.4/bin/qmake)
    CMake Error at cmake/modules/FindAutomoc4.cmake:53 (message):
    Did not find automoc4 (part of kdesupport).
    Call Stack (most recent call first):
    cmake/modules/FindKDE4Internal.cmake:242 (find_package)
    CMakeLists.txt:27 (find_package)

    -- Configuring done

    any clue how to resolve it ??? any help is welcome ... thanks in advance

  8. @c.d.nguyen

    try using "xclipboard" -

    fink install xclipboard

  9. Hi, I have been following the instructions.
    I get to run .configure in qt-copy, as per the instructions, and I get this --
    The QtDBus module cannot be enabled because libdbus-1 version 0.62 was not found.
    Turn on verbose messaging (-v) to ./configure to see the final report.
    If you believe this message is in error you may use the continue
    switch (-continue) to ./configure to continue.

    I obviously need to install dbus for Mac OS X.
    Any ideas?

  10. My kile cmake required the line

    cmake ../ ...blahblah...

    instead of

    cmake ../kile ...blahblah...

  11. Hi,

    I have the same problem as Dave.

    Creating qmake. Please wait...
    make: Nothing to be done for `first'.
    The QtDBus module cannot be enabled because libdbus-1 version 0.62 was not found.
    Turn on verbose messaging (-v) to ./configure to see the final report.
    If you believe this message is in error you may use the continue
    switch (-continue) to ./configure to continue.

    Any ideas?



  12. how did you compile kdelibs ?!

    I tried to eliminate errors by installing as many packages as I could using macports but at the end I get "Configuring incomplete, errors occurred!"
    Although the errors are all related to optional packages!

  13. I was unable to compile kile it exited with this command

    CMake Error at /opt/kde4/share/apps/cmake/modules/FindQt4.cmake:1281 (MESSAGE):
    Qt qmake not found!
    Call Stack (most recent call first):
    /opt/kde4/share/apps/cmake/modules/FindKDE4Internal.cmake:223 (find_package)
    /opt/kde4-deps/share/cmake-2.7/Modules/FindKDE4.cmake:69 (FIND_PACKAGE)
    CMakeLists.txt:3 (find_package)

    Appreciate your help very much.

  14. I had trouble compiling kdebase without qt3 support, so I would advise that you compile qt4 with it included, just in case.

  15. Hi,
    I'm trying to install kile using the "quick" way, and when I enter

    cmake ../kile -DCMAKE_INSTALL_PREFIX=/opt/kde4-svn -Wno-dev -DCMAKE_BUILD_TYPE=Release

    I get the following error message:

    CMake Error: The source directory "/Users/agelos/" does not exist.

    Could you help?

  16. I got Kile to make. Now it however complains about not recgnising the mime type (application/octet-string).

    Is there some path I should want to set or so?

  17. Could you give more information as to where you placed each directory as you installed them? Your guide is vague, and I installed all of the programs in my home directory, but I am still getting errors for all of this to work. Mostly I get:
    "Error when bootstrapping CMake:
    Problem while running initial CMake

    When trying to run
    "./configure --prefix=/opt/kde4-deps-svn
    sudo make install"

    after downloading CMake from svn and running those commands from the CMake folder.

    What needs to be done to fix this error?


All the projects here are under a Creative Commons 3.0 licence! You can use and distribute them as you like (just quote the author so he knows his work is not useless)!

If you wish to get in touch with me write at