A good setup for Perl on OSX

本文介绍如何在OSX上安装Perl及必要的工具,包括通过Xcode安装命令行工具,使用Perlbrew进行Perl版本管理,以及利用cpanm简化模块安装过程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

A good setup for Perl on OSX:

Install Perl on Mac OSX
  • Install "Command Line Tools for Xcode", either directly or through Xcode, both available from Apple Developer downloadsexternal link (free registration required). Xcode can also be installed through the App Store application.
  • Open the Terminal.app (found in Applications -> Utilities) and copy & paste the command below into it (then press the 'return' key):
    curl -L http://xrl.us/installperlosx | bash
  • Once this is finished (it takes several minutes), quit the Terminal app.

If you are interest in the details of the setup above...

  • To build and install Perl and many of the thousands of useful Perl modules you need to have a compilerexternal link. For OSX the easiest way to get a compiler is to install "Command Line Tools for Xcode" (about 100 Megs), either directly or through Xcode (several Gigs), both available from Apple Developer downloadsexternal link. Xcode is also available through the App Storeexternal link application. Some versions of the OSX install DVD or SSD come with the 'developer tools', which contains Xcode. Only the 'unix tools' section of Xcode is actually required, no specific version of Xcode is needed, the latest is available directly through the App Store.
  • To interact with the command line and run Perl commands, a terminal application is needed. OSX comes with Terminal.app by default, there are alternatives available as well.
  • OSX uses .bash_profile, but most other systems (and instructions) look for .bashrc, this code sets up .bash_profie to also run anything in .bashrc. There are other differencesexternal link but these are not important to us.
  • The Perlbrewexternal link website lists many of it's advantages. We recommend it here because it separates your installation from the system Perl, this makes upgrading your OS less likely to cause issues with your own Perl setup. It also means you can use a newer Perl than the default one which comes with your OS.
  • App-cpanminusexternal link provides the cpanm tool, which makes installing modules very simple to do.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值