Thursday, August 16, 2012

Homebrew package manager for OSX + Tips

Forget Fink and MacPorts, Homebrew is the miracle package manager you are looking for.

Homebrew installs packages to their own directory and then symlinks their files into /usr/local.
Then there is no need to tweak the system's and compiler's search paths to reach the packages. Also the installation is extremely simple, and the syntax familiar:
  brew [search, install, remove] packagename

The big critic I read about was the lack of packages. Never noticed, probably because the number of packages have exploded during the last year. The packages are built locally, so compiling large applications may take considerable time.

Tips:
  • Compile for multiple architectures. If, for some reason, you need to compile a program/library with multiple architecture support, like on a 64bits system but with 32bits legacy applications. Then, while installing use the --universal flag:
         brew install --universal -v libtiff
    it will compile a "fat" library with multiple architectures (env UNIVERSAL_ARCH="i386 x86_64" to specify which architectures).
  • Python. This setting is very important, but may depend on the version of OSX.
    When I installed Homebrew it did not compile its own python, instead it used the python that came with the system. Then all python packages installed with Homebrew are stored in: /usr/local/lib/python2.6/site-packages,  which is not in the search path for  python. It must be specified with the environment variable PYTHONPATH, by adding this line to ~/.bash_profile :
      # CONTRIBUTED PYTHON LIBRARIES
     
      #------------------------------------------
     
      export PYTHONPATH=/usr/local/lib/python2.6/site-packages:$PYTHONPATH
     
      #------------------------------------------


    More on Python and Homebrew.
  • Big projects like GIMP, Inkscape, Firefox,  and many others...  Are not available as packages, they are already distributed as standalone OSX applications.

No comments:

Post a Comment