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.