我正在尝试从 Mac Ports 安装端口,但似乎它最后p5-app-ack
没有创建二进制文件:/opt/local/bin/ack
$ sudo port search *app-ack
Password:
p5-app-ack @1.960.0 (perl)
A grep replacement that ignores .svn/CVS/blib directories
p5.8-app-ack @1.960.0 (perl)
A grep replacement that ignores .svn/CVS/blib directories
p5.10-app-ack @1.960.0 (perl)
A grep replacement that ignores .svn/CVS/blib directories
p5.12-app-ack @1.960.0 (perl)
A grep replacement that ignores .svn/CVS/blib directories
p5.14-app-ack @1.960.0 (perl)
A grep replacement that ignores .svn/CVS/blib directories
p5.16-app-ack @1.960.0 (perl)
A grep replacement that ignores .svn/CVS/blib directories
Found 6 ports.
$ perl --version
This is perl 5, version 12, subversion 4 (v5.12.4) built for darwin-thread-multi-2level
Copyright 1987-2010, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.
$ sudo port install p5-app-ack
---> Computing dependencies for p5-app-ack
---> Cleaning p5-app-ack
---> Updating database of binaries: 100.0%
---> Scanning binaries for linking errors: 35.0%
---> No broken files found.
$
$ ls /opt/local/bin/ac*
/opt/local/bin/ack-5.12 /opt/local/bin/aclocal /opt/local/bin/aclocal-1.12 /opt/local/bin/activation-client /opt/local/bin/acyclic
$ which ack
$ ack
-bash: ack: command not found
更新
如果我随后尝试安装p5.12-app-ack
,我会得到
$ sudo port install p5.12-app-ack
Password:
---> Computing dependencies for p5.12-app-ack
---> Cleaning p5.12-app-ack
---> Scanning binaries for linking errors: 100.0%
---> No broken files found.
$
更新:cpan
同样无效
$ack
-bash: ack: command not found
$sudo port p5-app-ack
Password:
Error: Unrecognized action "port p5-app-ack"
$sudo port installed p5-app-ack
The following ports are currently installed:
p5-app-ack @1.960.0_1 (active)
$sudo cpan App::Ack
Reading '/Users/foobar/.cpan/Metadata'
Database was generated on Sun, 18 Dec 2011 20:10:30 GMT
Fetching with Net::FTP:
ftp://cpan.mirror.cdnetworks.com/CPAN/authors/01mailrc.txt.gz
Reading '/Users/foobar/.cpan/sources/authors/01mailrc.txt.gz'
............................................................................DONE
Fetching with Net::FTP:
ftp://cpan.mirror.cdnetworks.com/CPAN/modules/02packages.details.txt.gz
Reading '/Users/foobar/.cpan/sources/modules/02packages.details.txt.gz'
Database was generated on Sat, 15 Dec 2012 21:19:04 GMT
HTTP::Date not available
............................................................................DONE
Fetching with Net::FTP:
ftp://cpan.mirror.cdnetworks.com/CPAN/modules/03modlist.data.gz
Reading '/Users/foobar/.cpan/sources/modules/03modlist.data.gz'
............................................................................DONE
Writing /Users/foobar/.cpan/Metadata
Running install for module 'App::Ack'
Running make for P/PE/PETDANCE/ack-1.96.tar.gz
Fetching with Net::FTP:
ftp://cpan.mirror.cdnetworks.com/CPAN/authors/id/P/PE/PETDANCE/ack-1.96.tar.gz
Fetching with Net::FTP:
ftp://cpan.mirror.cdnetworks.com/CPAN/authors/id/P/PE/PETDANCE/CHECKSUMS
Checksum for /Users/foobar/.cpan/sources/authors/id/P/PE/PETDANCE/ack-1.96.tar.gz ok
CPAN.pm: Building P/PE/PETDANCE/ack-1.96.tar.gz
Checking if your kit is complete...
Looks good
Warning: prerequisite File::Next 0.4 not found.
No documentation found for "File::Next".
Writing Makefile for ack
Writing MYMETA.yml and MYMETA.json
---- Unsatisfied dependencies detected during ----
---- PETDANCE/ack-1.96.tar.gz ----
File::Next [requires]
Running make test
Delayed until after prerequisites
Running make install
Delayed until after prerequisites
Running install for module 'File::Next'
Running make for P/PE/PETDANCE/File-Next-1.10.tar.gz
Fetching with Net::FTP:
ftp://cpan.mirror.cdnetworks.com/CPAN/authors/id/P/PE/PETDANCE/File-Next-1.10.tar.gz
Checksum for /Users/foobar/.cpan/sources/authors/id/P/PE/PETDANCE/File-Next-1.10.tar.gz ok
CPAN.pm: Building P/PE/PETDANCE/File-Next-1.10.tar.gz
Checking if your kit is complete...
Looks good
Writing Makefile for File::Next
Writing MYMETA.yml and MYMETA.json
cp Next.pm blib/lib/File/Next.pm
Manifying blib/man3/File::Next.3pm
PETDANCE/File-Next-1.10.tar.gz
/usr/bin/make -- OK
'YAML' not installed, will not store persistent state
Running make test
PERL_DL_NONLAZY=1 /opt/local/bin/perl5.16 "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/00-load.t ....... # Testing File::Next 1.10, Perl 5.016001, /opt/local/bin/perl5.16
t/00-load.t ....... ok
t/api.t ........... ok
t/basic.t ......... ok
t/dirs.t .......... ok
t/dot.t ........... ok
t/everything.t .... ok
t/follow.t ........ ok
t/from_file.t ..... ok
t/from_stdin.t .... ok
t/methods.t ....... ok
t/named-pipe.t .... ok
t/parms.t ......... ok
t/pod-coverage.t .. skipped: Test::Pod::Coverage 1.04 required for testing POD
t/pod.t ........... skipped: Test::Pod 1.14 required for testing POD
t/sort.t .......... ok
t/zero.t .......... ok
All tests successful.
Files=16, Tests=82, 1 wallclock secs ( 0.11 usr 0.07 sys + 0.59 cusr 0.15 csys = 0.92 CPU)
Result: PASS
PETDANCE/File-Next-1.10.tar.gz
/usr/bin/make test -- OK
Running make install
Installing /opt/local/lib/perl5/site_perl/5.16.1/File/Next.pm
Installing /opt/local/share/perl5.16/siteman/man3/File::Next.3pm
Appending installation info to /opt/local/lib/perl5/5.16.1/darwin-thread-multi-2level/perllocal.pod
PETDANCE/File-Next-1.10.tar.gz
/usr/bin/make install -- OK
Running make for P/PE/PETDANCE/ack-1.96.tar.gz
Has already been unwrapped into directory /Users/foobar/.cpan/build/ack-1.96-wJTiPB
CPAN.pm: Building P/PE/PETDANCE/ack-1.96.tar.gz
cp Ack.pm blib/lib/App/Ack.pm
cp Repository.pm blib/lib/App/Ack/Repository.pm
cp Plugin.pm blib/lib/App/Ack/Plugin.pm
cp Resource.pm blib/lib/App/Ack/Resource.pm
cp Basic.pm blib/lib/App/Ack/Plugin/Basic.pm
/opt/local/bin/perl5.16 squash ack-base File::Next Ack.pm Repository.pm Resource.pm Basic.pm > ack
Reading ack-base
Reading /opt/local/lib/perl5/site_perl/5.16.1/File/Next.pm
Reading Ack.pm
Reading Repository.pm
Reading Resource.pm
Reading Basic.pm
chmod 0755 ack
/opt/local/bin/perl5.16 -T -c ack
ack syntax OK
/opt/local/bin/perl5.16 -T ack --noenv --help > ack-help.txt || perl -e0
/opt/local/bin/perl5.16 -T ack --noenv --help=types > ack-help-types.txt || perl -e0
/opt/local/bin/perl5.16 -T ack --noenv --help=dirs > ack-help-dirs.txt || perl -e0
cp ack blib/script/ack
/opt/local/bin/perl5.16 -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/ack
Manifying blib/man1/ack.1pm
PETDANCE/ack-1.96.tar.gz
/usr/bin/make -- OK
Running make test
PERL_DL_NONLAZY=1 /opt/local/bin/perl5.16 "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/00-load.t ............... 1/4 # Testing App::Ack 1.96, File::Next 1.10, Perl 5.016001, /opt/local/bin/perl5.16
t/00-load.t ............... ok
t/ack-1.t ................. ok
t/ack-a.t ................. ok
t/ack-binary.t ............ ok
t/ack-c.t ................. ok
t/ack-color.t ............. ok
t/ack-column.t ............ ok
t/ack-env.t ............... ok
t/ack-g.t ................. ok
t/ack-group.t ............. ok
t/ack-h.t ................. ok
t/ack-ignore-dir.t ........ ok
t/ack-line.t .............. ok
t/ack-match.t ............. ok
t/ack-o.t ................. ok
t/ack-passthru.t .......... ok
t/ack-print0.t ............ ok
t/ack-text.t .............. ok
t/ack-type.t .............. ok
t/ack-u.t ................. ok
t/ack-v.t ................. ok
t/ack-w.t ................. ok
t/code.t .................. ok
t/command-line-files.t .... ok
t/context.t ............... ok
t/encoding.t .............. ok
t/file-permission.t ....... skipped: Can't be run as root
t/filetypes.t ............. ok
t/illegal-regex.t ......... ok
t/incomplete-last-line.t .. ok
t/interesting.t ........... ok
t/longopts.t .............. ok
t/module.t ................ ok
t/multiline.t ............. ok
t/pod.t ................... skipped: Test::Pod 1.14 required for testing POD
t/rc.t .................... ok
t/standalone.t ............ ok
t/tar.t ................... skipped: Testing the uncompleted feature of acking through a tar file.
t/zero.t .................. ok
All tests successful.
Files=39, Tests=585, 20 wallclock secs ( 0.29 usr 0.13 sys + 13.47 cusr 2.57 csys = 16.46 CPU)
Result: PASS
PETDANCE/ack-1.96.tar.gz
/usr/bin/make test -- OK
Running make install
Manifying blib/man1/ack.1pm
Installing /opt/local/lib/perl5/site_perl/5.16.1/App/Ack.pm
Installing /opt/local/lib/perl5/site_perl/5.16.1/App/Ack/Plugin.pm
Installing /opt/local/lib/perl5/site_perl/5.16.1/App/Ack/Repository.pm
Installing /opt/local/lib/perl5/site_perl/5.16.1/App/Ack/Resource.pm
Installing /opt/local/lib/perl5/site_perl/5.16.1/App/Ack/Plugin/Basic.pm
Installing /opt/local/share/perl5.16/siteman/man1/ack.1pm
Installing /opt/local/libexec/perl5.16/sitebin/ack
Appending installation info to /opt/local/lib/perl5/5.16.1/darwin-thread-multi-2level/perllocal.pod
PETDANCE/ack-1.96.tar.gz
/usr/bin/make install -- OK
$ which ack
答案1
你可以试试:
sudo cpan App::Ack
/opt/local/bin/ack
它会安装 ack 并使用您机器上的默认 perl 环境配置二进制文件。安装后,您只需运行“ack pattern”即可。
答案2
包 p5-app-ack 是一个存根包,它安装一个包含与您安装的 perl 版本匹配的实际可执行文件的包。
shiny:~ fl$ port deps p5-app-ack
Full Name: p5-app-ack @1.960.0_1
Library Dependencies: p5.12-app-ack
由于您已经安装了 perl5.12,您将找到存根包和包含二进制文件的包:
shiny:~ fl$ port list p5*-app-ack
p5-app-ack @1.960.0 perl/p5-app-ack
p5.12-app-ack @1.960.0 perl/p5-app-ack
并且程序将被安装以匹配 Perl 环境:
shiny:~ fl$ port contents p5.12-app-ack
Port p5.12-app-ack contains:
/opt/local/bin/ack-5.12
/opt/local/lib/perl5/vendor_perl/5.12.4/App/Ack.pm
/opt/local/lib/perl5/vendor_perl/5.12.4/App/Ack/Plugin.pm
/opt/local/lib/perl5/vendor_perl/5.12.4/App/Ack/Plugin/Basic.pm
/opt/local/lib/perl5/vendor_perl/5.12.4/App/Ack/Repository.pm
/opt/local/lib/perl5/vendor_perl/5.12.4/App/Ack/Resource.pm
/opt/local/lib/perl5/vendor_perl/5.12.4/darwin-thread-multi-2level/auto/ack/.packlist
/opt/local/libexec/perl5.12/ack
/opt/local/share/perl5.12/man/man1/ack.1pm
你可以添加/opt/local/libexec/perl5.12
到你的$PATH
,或者/opt/local/libexec/perl5.12/ack
在你的$PATH