Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Installing Graphite in OS X Mavericks

Follow these steps to install graphite on OS X Mavericks.

Prerequisites

  • Homebrew
  • Python 2.7
  • Git

Install dependencies

Install Cairo and friends

brew install cairo
brew install py2cairo

Install Django

pip install Django==1.5
pip install django-tagging

Install Graphite

sudo pip install carbon
pip install whisper
sudo pip install graphite-web
sudo pip install Twisted==11.1.0 

sudo chown -R <your username>:staff /opt/graphite

Configure graphite

cp /opt/graphite/conf/carbon.conf{.example,}
cp /opt/graphite/conf/storage-schemas.conf{.example,}

Create default database

cd /opt/graphite/webapp/graphite

# Modify this file to change database backend (default is sqlite).
cp local_settings.py{.example,}

# Initialize database
python manage.py syncdb

Start carbon

python /opt/graphite/bin/carbon-cache.py start

Start Graphite

python /opt/graphite/bin/run-graphite-devel-server.py /opt/graphite

Hope that it works!

Go to:

http://localhost:8080

You should see this if it works properly:

bacon

If you get a broken image, it most likely means that something is wrong py2cairo and cairo.

Check the debug output here:

http://localhost:8080/render

Optional convenience aliases

Add this to your .bashrc or .bash_profile:

alias carbon='python /opt/graphite/bin/carbon-cache.py'
alias graphite-web='python /opt/graphite/bin/run-graphite-devel-server.py /opt/graphite'

Additional resources

@jpemberthy

This comment has been minimized.

Copy link

jpemberthy commented Dec 10, 2014

👍

@damianesteban

This comment has been minimized.

Copy link

damianesteban commented Jan 29, 2015

This is an excellent guide. Worked flawlessly on 10.10.2. Thank you.

@luckykurhe

This comment has been minimized.

Copy link

luckykurhe commented Mar 27, 2015

thanks a lot.. actual graphite docs can refer from here ;)

@bs-sdev

This comment has been minimized.

Copy link

bs-sdev commented Mar 27, 2015

Hello every one,

I am trying to follow your tutorial (which is really clear by the way ^^). But I am encountering an issue on the graph interface :/. Indeed, when go the the localhost:8080, apparently I have a font problem like this :

http://s24.postimg.org/otdnvih4l/Capture_d_cran_2015_03_27_17_14_13.png

and this :

http://s7.postimg.org/6q95nguaz/Capture_d_cran_2015_03_27_17_15_10.png

I tried to put a graph at 1pt, but it is unreadable :/ Does someone have this issue????

Thanks

@slowenthal

This comment has been minimized.

Copy link

slowenthal commented Mar 28, 2015

I also have the exact same font problem as bs-sdev and am running on yosemite. Are there particular versions of cairo and py2cairo to use?

@slowenthal

This comment has been minimized.

Copy link

slowenthal commented Mar 31, 2015

I've solved the issue above. When I did brew install cairo, it installed 1.14.2 which has the bug. I went ahead and installed a back version - In my case I chose 1.12.6. To do it,

type
brew versions cairo
If you don't have the versions command do this
brew tap homebrew/boneyard

brew versions cairo

You get this output:

1.14.2 git checkout 842ec2d /usr/local/Library/Formula/cairo.rb
1.14.0 git checkout e78bed9 /usr/local/Library/Formula/cairo.rb
1.12.16 git checkout 26d5775 /usr/local/Library/Formula/cairo.rb
1.12.14 git checkout 96680d5 /usr/local/Library/Formula/cairo.rb
1.12.12 git checkout 084226c /usr/local/Library/Formula/cairo.rb
1.12.10 git checkout bc14222 /usr/local/Library/Formula/cairo.rb
1.12.8 git checkout c16eff9 /usr/local/Library/Formula/cairo.rb

cd /usr/local/Library/
git checkout 7073788 /usr/local/Library/Formula/cairo.rb
brew install cairo

@himos

This comment has been minimized.

Copy link

himos commented Apr 5, 2015

Thanks I had the same problem and reinstalling older version of cairo helped to me too. Only thing that was different for me - I needed to install carocffi again:

pip install cairocffi

@tonyghita

This comment has been minimized.

Copy link

tonyghita commented Apr 17, 2015

Such a good guide, thanks @relaxdiego

@chuyik

This comment has been minimized.

Copy link

chuyik commented May 1, 2015

Thanks @slowenthal and @himos and @relaxdiego, perfectly works on Yosemite 10.10.3!

@KarthicRaj

This comment has been minimized.

Copy link

KarthicRaj commented May 2, 2015

I am getting a broken image after installing graphite on my Yosemite.

@kittozheng

This comment has been minimized.

Copy link

kittozheng commented Jun 16, 2015

@slowenthal, I followed your solution for cairo version bug, and I tried to downgrade my cairo install by brew, but I encountered a problem that "brew versions" is not supported! I've searched for half an hour and I can't find some way. Could u give me some advice, thanks!

@yogamaha

This comment has been minimized.

Copy link

yogamaha commented Jun 28, 2015

I ran into issues with cairo.
Here is what I did to fix the problem:
Used cairo source & did a manual configure and install. This fixed the broken image problem.

$ curl http://cairographics.org/releases/cairo-1.12.18.tar.xz -o cairo.tar.xz
$ tar -xf cairo.tar.xz && cd cairo-1.12.18
$ ./configure --prefix=/usr/local --disable-dependency-tracking
$ make install

Source: https://github.com/Automattic/node-canvas/wiki/installation---osx

@spinlock99

This comment has been minimized.

Copy link

spinlock99 commented Jul 3, 2015

Thanks for the walk through. I'm not a python guy so it's very helpful to have the step by step. But -- not being a python guy -- I think I've hosed the install. It's failing when I try to initialize the database:

/opt/graphite/webapp/graphite$python manage.py syncdb
/opt/graphite/webapp/graphite/settings.py:244: UserWarning: SECRET_KEY is set to an unsafe default. This should be set in local_settings.py for better security
  warn('SECRET_KEY is set to an unsafe default. This should be set in local_settings.py for better security')
ImportError: No module named fields

Carbon looks OK (I think):

/opt/graphite/webapp/graphite$python /opt/graphite/bin/carbon-cache.py start
'WHISPER_FALLOCATE_CREATE is enabled but linking failed.'
carbon-cache (instance a) is already running with pid 57417

But Graphite barfs on not finding the fields module:

opt/graphite/webapp/graphite$python /opt/graphite/bin/run-graphite-devel-server.py /opt/graphite
Running Graphite from /opt/graphite under django development server

/usr/local/bin/django-admin.py runserver --pythonpath /opt/graphite/webapp --settings graphite.settings 0.0.0.0:8080
/opt/graphite/webapp/graphite/settings.py:244: UserWarning: SECRET_KEY is set to an unsafe default.  This should be set in local_settings.py for better security
  warn('SECRET_KEY is set to an unsafe default. This should be set in local_settings.py for better security')
/opt/graphite/webapp/graphite/settings.py:244: UserWarning: SECRET_KEY is set to an unsafe default. This should be set in local_settings.py for better security
  warn('SECRET_KEY is set to an unsafe default. This should be set in local_settings.py for better security')
Validating models...

Unhandled exception in thread started by <bound method Command.inner_run of <django.core.management.commands.runserver.Command object at 0x10e159390>>
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/django/core/management/commands/runserver.py", line 92, in inner_run
    self.validate(display_num_errors=True)
  File "/Library/Python/2.7/site-packages/django/core/management/base.py", line 280, in validate
    num_errors = get_validation_errors(s, app)
  File "/Library/Python/2.7/site-packages/django/core/management/validation.py", line 35, in get_validation_errors
    for (app_name, error) in get_app_errors().items():
  File "/Library/Python/2.7/site-packages/django/db/models/loading.py", line 166, in get_app_errors
self._populate()
  File "/Library/Python/2.7/site-packages/django/db/models/loading.py", line 75, in _populate
self.load_app(app_name)
  File "/Library/Python/2.7/site-packages/django/db/models/loading.py", line 96, in load_app
models = import_module('.models', app_name)
  File "/Library/Python/2.7/site-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
  File "/opt/graphite/webapp/graphite/events/models.py", line 6, in <module>
    from tagging.managers import ModelTaggedItemManager
  File "/Library/Python/2.7/site-packages/tagging/managers.py", line 7, in <module>
    from tagging.models import Tag
 File "/Library/Python/2.7/site-packages/tagging/models.py", line 10, in <module>
   from django.contrib.contenttypes.fields import GenericForeignKey
ImportError: No module named fields
@kalw

This comment has been minimized.

Copy link

kalw commented Jul 4, 2015

pip install django-tagging==0.3.6
that will through away the "ImportError: No module named fields"
or you could upgrade django in accordance to django-tagging 4 but from what i remember we need to stick to django 1.5

@spinlock99

This comment has been minimized.

Copy link

spinlock99 commented Jul 4, 2015

thanks @kalw that fixed graphite. Looks like I still might need to fix cairo because I'm seeing a broken image in Graphite rather than the blank graph but this is progress :)

@foovungle

This comment has been minimized.

Copy link

foovungle commented Jul 10, 2015

I also had to specify
pip install django-tagging==0.3.6

@fgbreel

This comment has been minimized.

Copy link

fgbreel commented Oct 19, 2015

Thanks @slowenthal, I had the same problem with the huge fonts!

But with the 1.12.6 version /render gives me HTTP 500.

This one worked for me: 1.14.0

 git checkout e78bed9 /usr/local/Library/Formula/cairo.rb
@luckykurhe

This comment has been minimized.

Copy link

luckykurhe commented Nov 3, 2015

@slowenthal / @fgbreel:
I am running into same issue (Mac OS 10.10.5)
while trying to go back to old version, versions command itself is not supported now, any idea on how to resolve it

$ brew versions cairo
Error: The versions command is no longer supported.
You can use the homebrew-versions tap instead:
https://github.com/Homebrew/homebrew-versions
Or use brew log to browse the git history.

$ brew tap homebrew/boneyard
Warning: Already tapped!

$ brew versions cairo
Error: The versions command is no longer supported.
You can use the homebrew-versions tap instead:
https://github.com/Homebrew/homebrew-versions
Or use brew log to browse the git history.

$ brew tap homebrew/versions
Warning: Already tapped!

$ brew versions cairo
Error: The versions command is no longer supported.
You can use the homebrew-versions tap instead:
https://github.com/Homebrew/homebrew-versions
Or use brew log to browse the git history.

$

@fgbreel

This comment has been minimized.

Copy link

fgbreel commented Nov 10, 2015

@luckyhurhe, just run this:

git checkout e78bed9 /usr/local/Library/Formula/cairo.rb

and then

brew install cairo

@mr-fixit

This comment has been minimized.

Copy link

mr-fixit commented Mar 3, 2016

I got to the step of python manage.py syncdb and was told:

Unknown command: 'syncdb'
Type 'manage.py help' for usage.

I found that python manage.py migrate --run-syncdb did the trick.

For reference, here are the versions involved:

$ python manage.py --version
1.9.3
$ python --version
Python 2.7.10
@MaxGabriel

This comment has been minimized.

Copy link

MaxGabriel commented Apr 4, 2016

I needed django-tagging==0.3.6 as others have mentioned. I also needed to install zope.interface with sudo easy_install zope.interface.

@reinhack

This comment has been minimized.

Copy link

reinhack commented Sep 22, 2016

in my /opt/graphite/ folder there's no webapp folder... does anyone know what might cause it?

@geeves

This comment has been minimized.

Copy link

geeves commented Oct 25, 2016

This was a lot of help, thanks! These instructions also work as well for El Capitan.

  • Used MaxGabriel's suggestion of django-tagging and zope.intertace.
  • Install cairocffi: pip install cairocffi - Graphite will run without it, but none of your graphs will render (they'll be broken images).

I have it setup to run with Cassandra and Grafana and also followed much of the .ini and .conf setup from this article https://www.pythian.com/blog/monitoring-apache-cassandra-metrics-graphite-grafana/

@dabidgs3

This comment has been minimized.

Copy link

dabidgs3 commented Dec 22, 2016

Great contributions - for those ones struggling with database sync there is a missing version : sudo pip install django-tagging==0.3

@drewish

This comment has been minimized.

Copy link

drewish commented Apr 6, 2017

I needed to add sudo to the Django setup commands

@skabbit

This comment has been minimized.

Copy link

skabbit commented May 19, 2017

Current way to have graphite running I've found is to update the following command:

pip install django-tagging==0.3.6
pip install Django==1.8
/opt/graphite/venv/graphite/lib/python2.7/site-packages/django/bin/django-admin.py syncdb --settings=graphite.settings --pythonpath /opt/graphite/webapp

NOTE: Use your path to venv

But still I have problems with serving static files...

@jdrain

This comment has been minimized.

Copy link

jdrain commented Jun 9, 2017

I'm having issues with the "Create Default Database" step... There is no such file manage.py in the directory /opt/graphite/webapp/graphite

Anyone have an idea why this is the case/if there is a work around?

@jeffnelson

This comment has been minimized.

Copy link

jeffnelson commented Sep 21, 2017

@jdrain - I'm having the same issue. you found any answers?

@amarjitdhillon

This comment has been minimized.

Copy link

amarjitdhillon commented Oct 28, 2017

I am also having same issue on mac , there is no manage.py in /opt/graphite

please help

@siddhartha-chandra

This comment has been minimized.

Copy link

siddhartha-chandra commented Dec 7, 2017

@odd-snail @jeffnelson @jdrain
per my understanding the --run-syncdb option allows for creating the default schema and tables

This worked for me:
django-admin migrate --pythonpath /opt/graphite/webapp --settings graphite.settings --run-syncdb

@siddhartha-chandra

This comment has been minimized.

Copy link

siddhartha-chandra commented Dec 7, 2017

btw any idea what are the default credentials to access the Login page of Graphite? I have started the server with the default sqlite3 backend and unable to get authenticated in the login section

@sunfeng90

This comment has been minimized.

Copy link

sunfeng90 commented Mar 25, 2018

Good job

@ank29

This comment has been minimized.

Copy link

ank29 commented Jul 11, 2018

python manage.py syncdb

Where should I run this command from ?
I am getting the following exception : /usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: can't open file 'manage.py': [Errno 2] No such file or directory

@pchychi-blox

This comment has been minimized.

Copy link

pchychi-blox commented Apr 19, 2019

ank29, dont bother running it from local

use below as siddhartha-chan suggested:
django-admin migrate --pythonpath /opt/graphite/webapp --settings graphite.settings --run-syncdb

@nikhil133

This comment has been minimized.

Copy link

nikhil133 commented Nov 4, 2019

Can any one help me to configure remote graphite.
or is there any way to have carbon-relay-ng in mac

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.