How do I install ack on OS X (10.8.4)?
Asked Answered
A

2

13

I am new to OS X and I am unable to figure out how to install ack. The instructions here didn't help, because the command "install" is failing. Please guide me proper commands.

So far, I have downloaded ack 2.04 and placed it in the /usr/bin folder and then ran perl Makefile.PL successfully. The next command install isn't working for me.

Alright answered 2/7, 2013 at 20:43 Comment(0)
K
27

If you use Homebrew you can simply do:

$ brew install ack

If you are new to OSX I highly recommend this approach because it makes installation of stuff like this MUCH easier. It is a package manager for OSX.

Homebrew link: http://brew.sh/

Kerwinn answered 9/7, 2013 at 3:39 Comment(0)
P
4

You can also use the MacPorts installer for OSX:

sudo port install p5.<nn>-app-ack

where <nn> is the version of your Perl installation (Ack is written in Perl). If you don't know the version of Perl you have installed, just type:

perl --version

and you'll know what you need for the port command. The Ack installation page has the information you need for this. More information about MacPorts can be found here.

Searching the web, you'll find LOTS of opinions about Homebrew versus MacPorts. I've used both; they both work (and both fail occasionally - installation of this kind is complex). You'll need to pick one or the other and stick with it as Homebrew doesn't play nicely with MacPorts (or vice versa, depending on your POV). Overriding choice for me is MacPorts as it has many more packages than Homebrew and it puts its stuff in /opt/local to stay out of the way of other programs. YMMV

Pram answered 15/8, 2013 at 14:15 Comment(3)
Works great. I added alias ack=ack-5.<nn> in my .zshrc for more convenienceDecrypt
Unfortunately, MacPorts doesn't help you by creating a symlink in /opt/local/bin. You can add /opt/local/libexec/perl5.12 to your PATH, but that's gross. Alternatives are an alias as @Sebastien suggested, or creating the symlink yourself (sudo ln -s /opt/local/libexec/perl5.12/ack /opt/local/bin, or some other place like ~/bin if that's in your path). The canonical MacPorts way to handle this sort of thing is port select --set ack some-version-specific-ack, but there's no app group for ack.Selffertilization
Note that you can also port install p5-app-ack, which is a meta package that will currently get you p5.12-app-ack, so at least you don't have to remember the Perl version details.Selffertilization

© 2022 - 2024 — McMap. All rights reserved.