4

I've got assignment to do for university and they say to install a virtual machine with ubuntu or Windows, install VTK and work with code::blocks. But I prefer XCode, and the virtual machine kills the battery life.

And i'm struggling installing VTK on my mac for hours now. I've tried many things and, lastly, How to install VTK 6.1 for OSX 10.8 with Cocoa/XCode support?, without success. (Actually I got lost at the options ticking for cmake: I didn't see all of the listed options. And trying to make showed the error "make: *** No targets specified and no makefile found. Stop.")

Also, I'm lost with the Qt things (is it necessary for me ?) or the python things (normally it's on my mac but is it the right version ?) and the wrap stuff; and I don't know if the procedures I found apply for my case.

To fix the idea, the VTK installing part I'm trying to reproduce on my mac is described for Ubuntu as follow:

sudo apt-get install libvtk6-dev
sudo apt-get install libpython2.7-dev

and after that, for the CMake-gui building options I have to set is

VTK_DIR = /usr/lib/cmake/vtk-6.0

How to do the equivalent on mac OSX?

If that can help, the VTK files I use are

#include <vtkCellArray.h>
#include <vtkCellData.h>
#include <vtkDoubleArray.h>
#include <vtkPoints.h>
#include <vtkVertex.h>
#include <vtkLine.h>
#include <vtkTriangle.h>
#include <vtkQuad.h>
#include <vtkPolyData.h>
#include <vtkPolyDataMapper.h>
#include <vtkActor.h>
#include <vtkRenderWindow.h>
#include <vtkRenderer.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkTubeFilter.h>
#include <vtkCleanPolyData.h>
#include <vtkCubeSource.h>
#include <vtkSphereSource.h>
#include <vtkGlyph3D.h>
#include <vtkProperty.h>
#include "vtkCamera.h"
Community
  • 1
  • 1
CaptainBleuten
  • 95
  • 1
  • 1
  • 7

1 Answers1

9

Just use Homebrew, the package manager for Mac OS. Install Homebrew with:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

And then install VTK with:

brew install vtk

Optionally you can install it with QT-support (python is already enabled):

brew install vtk --with-qt

For more install options:

brew info vtk
Lars Bilke
  • 4,940
  • 6
  • 45
  • 63
  • Thank you very much for your answer. Finally I passed across the inaccuracies of this [tutorial](https://www.cs.purdue.edu/homes/cs530/projects/project0.html): 1st, the `ccmake ..` command didn't work (seems to be that newer CMake is only graphical) 2nd, the CMake option `VTK_DATA_STORE` replaced `VTK_DATA_ROOT`. The examples at the end didn't work (probably because I don't have QT) but it worked fine so far, for what I need. Anyway, if I have to reinstall my mac or if I have problems with my installation, I'll try your option, which seems a LOT simpler. – CaptainBleuten Oct 02 '15 at 20:59
  • `brew install vtk` does not work. Brew does not seem to have VTK formula. Could you please confirm. – Anwar Shaikh Jun 30 '17 at 21:35
  • 1
    I had to run this command first `brew tap homebrew/homebrew-science` – tanvach Jul 07 '17 at 02:36
  • 1
    Update: homebrew/science is now deprecated, you can just run `brew install vtk` from the main tap – Biennial Jun 24 '19 at 21:10