Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Installing ag: the silver searcher on CentOS.

Installing ag on CentOS

Prerequistes

  • libpcre
  • liblzma

Download, build and install

$ sudo yum install -y pcre-devel

$ sudo yum install xz-devel

$ cd /usr/local/src

$ sudo git clone https://github.com/ggreer/the_silver_searcher.git

$ cd the_silver_searcher

$ sudo ./build.sh

$ sudo make install

$ which ag
/usr/local/bin/ag
@stalamuerte
Copy link

stalamuerte commented Jul 17, 2019

Thank you !

@beppe9000
Copy link

beppe9000 commented Sep 9, 2019

For some reason my centos finds no package so it was still useful. Somebody should post how to add a repository with yum ;P

@warb12
Copy link

warb12 commented Nov 20, 2019

I needed zlib dev...

so: sudo yum -y install pcre-devel xz-devel zlib-devel

@warb12
Copy link

warb12 commented Nov 20, 2019

what repo is the_silver_surfer in for CentOS 8 ?

@pilot513
Copy link

pilot513 commented Dec 6, 2019

@warb12
I don't found "the_silver_searcher" for RHEL/OEL 8 release
You must build it form src:
[lot@oel8 src]$ cat /etc/os-release | grep '^NAME=' | cut -d'"' -f2 && uname -vrp Oracle Linux Server 4.18.0-147.0.3.el8_1.x86_64 #1 SMP Wed Nov 20 19:11:37 PST 2019 x86_64

git clone https://github.com/ggreer/the_silver_searcher.git && cd the_silver_searcher/ ./build.sh make sudo make install

Then:
`[lot@oel8 ~]$ ll /usr/local/bin/ag && LANG=US /usr/local/bin/ag | head -n10
-rwxr-xr-x. 1 root root 319000 дек 6 11:40 /usr/local/bin/ag

Usage: ag [FILE-TYPE] [OPTIONS] PATTERN [PATH]
Recursively search for PATTERN in PATH.
Like grep or ack, but faster.
Example:
ag -i foo /bar/`

@andersonreinkordt
Copy link

andersonreinkordt commented Dec 23, 2019

HUZZZAH!

@beppe9000
Copy link

beppe9000 commented Dec 23, 2019

Also... yum provides the_silver_searcher

@dhull
Copy link

dhull commented Feb 27, 2020

On CentOS 8, you can also build an RPM using the CentOS 7 SRPM. Something like the following worked for me.

curl -O https://download-ib01.fedoraproject.org/pub/epel/7/SRPMS/Packages/t/the_silver_searcher-2.1.0-1.el7.src.rpm
yum install -y rpm-build xz-devel bash-completion
rpmbuild --rebuild the_silver_searcher-2.1.0-1.el7.src.rpm
sudo yum install $HOME/rpmbuild/RPMS/x86_64/the_silver_searcher-2.1.0-1.el8.x86_64.rpm

@subchen
Copy link

subchen commented May 9, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment