Reputation: 109
i did this once before, but have since forgotten how. i seem to remember having the ack.pl file in an "opt" directory close to root level on my Mac. i also remember that i will need to update my path settings in my ~/.profile
or ~/.bash_profile
, etc. I hope someone can fill in the blanks with some detailed instructions on how to do this properly.
Upvotes: 0
Views: 2102
Reputation: 109
OK - found the answer myself. Here's how i did it on OS X 10.10 Yosemite (no "opt" directory, no messing w/ editing my $PATH in /.profile, etc.)...
1 - set permissions on the directory /usr/local/bin to have read/write access for everyone.
(chmod 777 from Terminal - or - command + i from Finder, and set all to "Read & Write")
2 - then run the following command from the Terminal...
curl http://beyondgrep.com/ack-2.14-single-file > /usr/local/bin/ack && chmod 0755 /usr/local/bin/ack
(obviously the path to the file on http://beyondgrep.com will change as they release newer versions, so update this adddress accordingly from information at - http://beyondgrep.com/install/
3 - change read/write permissions on /usr/local/bin back to 755 ("Read & Write" by "system" only, group "wheel" and "everyone" set to "Read only")
and that's it!
Upvotes: 3
Reputation: 78792
There are a couple options, but before those, you'll need to fire up Terminal.app (or iTerm.app if you use iTerm2) and cd
to the directory you saved ack.pl
(prbly cd ~/Downloads
) and do:
$ chmod a+x ack.pl
so it's executable. You can test that with:
$ ./ack.pl --version
ack 2.14
Running under Perl 5.18.2 at /usr/bin/perl
Copyright 2005-2014 Andy Lester.
This program is free software. You may modify or distribute it
under the terms of the Artistic License v2.0.
If you don't get something like that output something is wonky with your download.
To make it available as just ack.pl
(you can also rename it to just ack
btw), you can do:
$ sudo mv ack.pl /usr/bin
which will put it in a location already in your PATH
.
If you have other non-Apple command-line software tools installed, then you may have a /usr/local/bin
already setup. You can test that with:
$ ls -ald /usr/local/bin
drwxr-xr-x 861 bob admin 29274 Dec 9 15:44 /usr/local/bin
$ echo $PATH | grep -c /usr/local/bin
1
If you don't get something similar to both results, then you don't have a /usr/local/bin
readily accessible (so you can skip the following mv
). If you do have something akin to both results, then you can just use that location by:
$ sudo mv ack.pl /usr/local/bin
(I'm only using sudo
to avoid potential permissions issues, it may work fine w/o sudo
for the /usr/local/bin
move).
If neither of those are acceptable, then you can do:
$ mkdir ~/bin # it won't do anything bad if you already have one
$ mv ack.pl ~/bin
and then edit your .profile
and add a line at the end with:
export PATH=~/bin:$PATH
Exit out of the terminal completely and go back in and you should be able to enter ack.pl
at any shell prompt without prefix and it should run.
Upvotes: 0