So I removed Xcode some time back, finding it more complicated than the intuitive GUI of PyCharm and Eclipse.

In my effort to use igraph library for Python 3 however, it requires cairo for plots.

While official link advises MacPort, since I removed Xcode, I followed this link.

With the advice given under the post, I also installed py2cairo using brew install.

Problem that remains is, python still cannot locate it. Quick auto-config nor adding library directories manually under “Preferences -> Pydev -> Interpreters - Python Interpreters” will solve the situation.

Eclipse Preference Setting

  • Can your question be simplified in any way? Your question title is this, “Package installation tools - e.g. Xcode and MacPort.” But then you state, “Long story short - can someone explain how these are related?” and provide a list of items. I posted an answer explaining how to solve this issue—which I believe to be the issue of you removing Xcode and then having things fail—but now I am not too sure what you are concerned about with this question. – JakeGould Jun 2 '18 at 16:10

Xcode provides a development environment (compiler, linker, IDE, and so forth) and is somewhat equivalent to the @Development Tools package group for RedHat type system, or the build-essential package on Debian systems.

MacPorts depends on Xcode, much as rpmbuild for RedHat depends on the @Development Tools package group. It does not make sense to try to use MacPorts without Xcode installed, just as one would not try to compile software on Linux without the above build or development packages installed.

Homebrew is an ports or package manager for macOS like MacPorts; Apple never made one so the community wrote Fink and Homebrew and MacPorts, which all do more or less the same job of providing unix software as ports or packages for macOS. FWIW, BSD systems tend to call them ports, and Linux systems packages, regardless the term they make 3rd party packages available for install.

Git is version control software that is commonly associated with software development, but could also be Dracs or Fossil or Mercurial.

  • This is definitely a well intention answer to the original poster’s original question, but at this point the question has changed so much it bears no resemblance to what you are answering here. – JakeGould Jun 3 '18 at 15:04
  • yes. sorry about it. I wanted to give some appreciations as all of your answers did help.. but I wasnt able to due to my reps..now I can! awesome! – HSL Jun 4 '18 at 11:15

Install the Xcode command line tools if you don’t need a full install of Xcode.

If you need Xcode command line tools without the HUGE Xcode application and environment, the preferred alternative for many developers is to simply install the Xcode command line tools like this:

xcode-select --install

When you run that command from the Terminal, a macOS software installation pop-up will appear asking you to install the Xcode command line tools. Of course, go ahead and install those.

And when that is done, try sudo port again. It should be working as expected.

The Xcode command line tools are basically just the core basics Xcode needs to operate from the command line. It’s the same command line tools you would get from a full Xcode install, but in a much smaller—and in my humble opinion—more reasonable package.

Homebrew is—in my humble opinion/experience—the better and more stable macOS package installer; opt for that over MacPorts methods if possible.

If that doesn’t work, I would recommend you undo what you have done, install Xcode again, uninstall pretty much all of the tools you installed with MacPorts and ditch MacPorts as well. Instead I would highly recommend installing and using Homebrew instead.

Homebrew is a package installer/management system for macOS—much like MacPorts—but in my experience it is cleaner, easier to use and understand and much better supported.

In fact, this answer on Stack Exchange seems to address your requirements of getting cairo install in macOS but using Homebrew.

  • 1
    Thanks Jake. My python is conda installed, and I did not like to use other methods but I tried your link with brew install py2cairo, and now iI can import on the shell finely. Eclipse still malfunctions. Usually they go together so now Im stuck with a different problem. But I will try to edit the question based on yr feedback, understand it has been difficult with limitation of 1.5 hrs when problems are intermixed. – HSL Jun 2 '18 at 16:53
  • Well, I think you should take some time away from this question to better focus on what your issues are. My recommendation of starting as a clean state stands. Also, if you are concern of too much “free advice” popping up here, I would recommend you temporarily “delete” this question. Then when you are ready to rephrase the question, go ahead and do that. Best of luck! – JakeGould Jun 2 '18 at 17:06

Found several links helpful for this topic:

I actually brew install-ed, manual installed, and installed cairocffi. Was reminded of the boost library that I had to direct IDE to find its path for, but this issue had multiple videos to guide me through.

In an essence, cairocffi solved the issue at the end. I can plot without importing anything on the script.

Specified paths are something in the like as followed:

enter image description here

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.