15

I went through fair amount of google search to install ack-grep on CentOS but I didn't find anything help. I also looked for the source codes but couldn't find it neither. Does anyone know how to install it on the OS?

Thanks a lot.

novo
  • 356
  • 1
  • 6
  • 17

6 Answers6

14

Could be essentially the same as https://stackoverflow.com/a/23155007/35946 but on CentOS 6.7 the answer is:

# yum install epel-release
# yum install ack
Community
  • 1
  • 1
lkraav
  • 2,696
  • 3
  • 26
  • 26
13

if you don't have the root permission, you can do as follows:

$ curl https://beyondgrep.com/ack-2.22-single-file > ~/bin/ack && chmod 0755 !#:3

or you can change to root user:

$ sudo su
# curl https://beyondgrep.com/ack-2.22-single-file > /bin/ack && chmod 0755 !#:3
SamCyanide
  • 323
  • 4
  • 15
lutaoact
  • 4,149
  • 6
  • 29
  • 41
  • 9
    Be sure to always check http://beyondgrep.com/install/ for the latest/greatest version. The solution above is hardcoded to a specific version. – Andy Lester Apr 16 '14 at 12:43
  • Latest ack is 2.18 and you can no longer use the "http" url, you must use https. Will edit accordingly. – SamCyanide Oct 23 '17 at 17:53
10

You can get it from the EPEL software repository.

From the EPEL FAQ:

For EL5:

su -c 'rpm -Uvh http://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm'
...
su -c 'yum install ack'

For EL6:

su -c 'rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm'
...
su -c 'yum install ack'
braveterry
  • 3,724
  • 8
  • 47
  • 59
4

Go to Beyond Grep and look at the section titled

Install The ack executeable

curl http://beyondgrep.com/ack-2.14-single-file > ~/bin/ack && chmod 0755 !#:3

And replace ack.2.14 with the current version of ack.

You may need to create the directory mkdir ~/bin/ first. You may also need to modify ~/.bashrc to include this new path E.G.:

PATH=$PATH:$HOME/bin
Then reload ~/.bashrc
source ~/.bashrc

Test the installation by running ack:

rpm -qa | ack s

This should display any installed packages containing the letter s. (some linux distributions may use ack-grep as the command.

P.Brian.Mackey
  • 43,228
  • 68
  • 238
  • 348
  • Latest version is 2.18, and you have to use https. `curl https://beyondgrep.com/ack-2.18-single-file > ~/bin/ack && chmod 0755 ~/bin/ack` – SamCyanide Oct 23 '17 at 17:56
1

How did you try installing it? Are you using yum? The package is probably not called "ack-grep", but just "ack".

The name "ack-grep" is a Debian-specific thing because there was already a package called "ack", so they called it "ack-grep" instead. That was years ago and now they're dropping the original "ack" package and renaming "ack-grep" to "ack".

Andy Lester
  • 91,102
  • 13
  • 100
  • 152
1

For RedHat Enterprise just do sudo yum install ack

Floern
  • 33,559
  • 24
  • 104
  • 119
Raul Rivero
  • 248
  • 3
  • 7