Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to install ImageMagick by using MacPorts. I've successfully installed MacPorts by using their Mountain Lion .pkg file.

I open the terminal and run:

sudo port install ImageMagick

However what I get is:

Error: Unable to execute port: Could not open file: /opt/local/var/macports/sources/

Although the error message doesnt contain "permission denied", I tried setting Portfile and its first parent folder to 777. And this obviously didn't solve my problem.

I have the latest Xcode installed.

share|improve this question
Have you executed sudo port selfupdate before attempting to install ImageMagick? – emcconville Mar 21 '13 at 13:19
Yes I did. But this operation didn't change the result because recently installed MacPorts tree is already up-to-date. What seems interesting is; the mentioned port file exists. It's not corrupted. It has the sufficient permissions (-rw-r--r-- 1 root wheel) so why can't root install it? – Lashae Mar 22 '13 at 6:54
I'm not on Lion, but tarball directory should be a sibling of release, not a child. Are you able to install other ports, like libpng? – emcconville Mar 22 '13 at 14:04
This is a valid path: /opt/local/var/macports/sources/‌​ics/libpng/Portfile. The only directory in is tarballs/ – timeSmith Mar 22 '13 at 21:52
up vote 3 down vote accepted

You need to give the user macports read access to /opt

in Finder choose "Go" -> "Go to Folder..."
type /opt and click "Go"
in Finder choose "File" -> "Get Info"
click the little padlock icon in the lower right corner of the "opt Info" window
enter your password (or the username and password of an administrator) and click "OK"
click the little plus in the lower left of the "opt Info" window
choose MacPorts from the list and click "Select"

try again sudo port install ImageMagick

share|improve this answer
Command line approach: port file foo for the path to port foo's Portfile, then cd there and chmod +r Portfile. Next sudo port install foo should work. – Ioannis Filippidis Nov 8 '13 at 10:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .