How can I avoid sudo-ing when installing Perl modules with 'cpan'?
cpan, perl, sudo
Solution
If it really bothers you to use `sudo`, you can use `local::lib` and install modules in your home directory - where you don't need super-user privileges.
That said, it shouldn't bother you to use `sudo`. There's nothing necessarily wrong with it. As Gbacon says, you need it if you want to install in `/usr/local` because `/usr/local` is shared by all users on the system (and so its permissions reflect that):
telemachus ~ $ ls -ld /usr/local/
drwxr-xr-x 17 root wheel 578 Jan 8 20:00 /usr/local/
Problem
I have installed Perl from source into /usr/local, and adjusted my path accordingly, following brian d foy's suggestion here. I'm sure I'm missing something, but, now I'm trying to install stuff with the 'cpan' command and it's failing because it can't write to /usr/local. I have to use sudo, which feels wrong to me. Should CPAN stuff go to another location? Is it normal to have to use sudo?