Mac – Can not run ack after installing it using MacPorts

macmacportspackage-management

After installing p5-app-ack using Macports I can see it is installed correctly.
enter image description here

I can not run it however.
I get ack: command not found.
and which ack displays nothing.
How can I see where port installed my ack and how to add it to the executalble PATH?

Best Answer

MacPorts, by default, installs into /opt/local/, judging by the screen shot ack should be in /opt/local/perl/p5-app-ack/ if you used the default install path. Make sure that path is in your $PATH environment variable.

To add it to your path edit your shell config file (probably ~/.profile or ~/.bashrc) and add or modify the following line. export PATH="$PATH":/opt/local/perl/p5-app-ack

I don't use MacPorts for ack, I install it manually with the following command from the ack install page.

curl http://betterthangrep.com/ack-standalone > ~/bin/ack && chmod 0755 !#:3

This will install ack into the $HOME/bin/ folder as a single large perl file and I did not have to modify my $PATH variable.